jsp - How to exclude one textbox from the others that are using isNumeric validation with jQuery? -
i'm using jquery 1.11x in jsp page textboxes. i'm working 5 text boxes , need make sure have numeric entries, however, want exclude first 1 has string representation of date in , validate 1 it's id or other way if guarantee uniqueness.
the code below checks of textboxes , fails on 1 string date value, if other textboxes have numbers. date format dd/mm/yyyy.
if(!$.isnumeric($('input:text').val())) { alert("all text boxes must have numeric values!"); return false; }
i couldn't above code work :not, tried selector, failed work.
if(!$.isnumeric($('input[type=checkbox]:not("#specialtextbox")').val())) { alert("all text boxes must have numeric values!"); return false; }
how exclude particular textbox string date,but still validate others have numbers?
you need loop textboxes
take of jquery each function here.
$('input[type="text"]').each(function(){ if ($(this).attr("id") !== 'specialtextbox') { if(!$.isnumeric($(this).val())) { alert("all text boxes must have numeric values!"); return false; } } });
Comments
Post a Comment