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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -