Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Jquery trigger change event upon dom ready

//You must declare the change event handler before calling trigger() or change() 
//otherwise it won't be fired. 
$(document).ready(function(){

    $('#countrylist').change(function(e){
       // Your event handler
    });

    // And now fire change event when the DOM is ready
    $('#countrylist').trigger('change');
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Jquery #trigger #change #event #dom #ready
ADD COMMENT
Topic
Name
6+6 =