.trigger ("blur") to collect data?

im trying trigger('blur'); in the input collection, but it doesn't seem to be that way.

available here http://jsfiddle.net/VUUme/1/

im getting the collection and i got the blur method but i'm not sure about the trigger part.

 var $inputs = $('#form').find('input'); alert('load'); $inputs.each(function(){ $(this).trigger('blur'); }); //i tried this to but with no success //$inputs.trigger('blur'); alert('after the blur'); $inputs.blur(function(){ var $this = $(this); if ($this.val() == ''){ alert('it works'); } }); 
+7
source share
1 answer

Put trigger() after , you define $inputs.blur() :

 alert('after the blur'); $inputs.blur(function(){ var $this = $(this); if ($this.val() == ''){ alert('it works'); } }); $inputs.trigger('blur'); 

Updated script: http://jsfiddle.net/VUUme/3/

+16
source

All Articles