[ACCEPTED]-jquery trigger all input elements with blur on load-copy

Accepted answer
Score: 10

You can use trick :)

$('input').each(function(){
  $(this).trigger('blur');
  //each input event one by one... will be blured
})

0

Score: 3
$('input[type=text], textarea').blur();

Or (potentially faster if everything is 1 bound with jQuery):

$('input[type=text], textarea').triggerHandler('blur');
Score: 0

Have you tried .trigger() ?

http://api.jquery.com/trigger/

0

Score: 0

How about, taking your copy input to summary 6 code and putting it into a function. keep 5 the blur as it is (except calling this function 4 rather than inline code) and on $(document).ready() select 3 all of your text boxes and copy them over 2 if they contain anything. Simpler than trying 1 to fudge events.

Score: 0

you could try to trigger them programmatically 2 by firing up

$("selector").trigger("blur"); 

api.jquery.com/trigger is your 1 friend :-)

Score: 0

You can use bellow code it will help you

 $('input:text').each(function(){
        $(this).trigger('blur');
    })

0

Score: 0

If you happened to add the same prefix to 3 all IDs of the input and wish to only blur 2 these inputs all at once, you can use the 1 wildcard selection and do it like this:

$("[id^=inputbox] input").trigger("blur");

More Related questions