[jquery] jQuery call function after load

Need to call a filter function on some options based on a radio selected (Link here), How can I call this after the page is loaded? the radio is set from a DB call and I would like to filter the options

This question is related to jquery

The answer is


$(window).bind("load", function() {

   // code here 
});

Crude, but does what you want, breaks the execution scope:

$(function(){
setTimeout(function(){
//Code to call
},1);
});

In regards to the question in your comment:

Assuming that you've previously bound your function to the click event of the radio button, add this to your $(document).ready function:

$('#[radioButtonOptionID]').click()

Without a parameter, that simulates the click event.


$(window).bind("load", function() {
  // write your code here
});