jquery each() function not working as intended -
i'm trying loop through inputs in form , if input not contain value, couple of things.
here's code far,
$('input').each(function() { if($(this+'[value!=""]')) { $('.requiredmark').hide(); $(this).after(checkmark); } });
what doing wrong? thank
that if-statement wrong. this
not refer string. use .val() value:
$('input').each(function(){ var $this = $(this); if($this.val() != "") { $('.requiredmark').hide(); $this.after(checkmark); } });
Comments
Post a Comment