Tag Archives: JQuery

Run JavaScript after page is loaded

If you need to call a JavaScript code when the html page is completely loaded, you can use JQuery.

At times some controls are not rendered and the JavaScript code runs, hence it is  not able to find controls which is not rendered yet and client side code throws exception.

Use $(document).ready feature of JQuery as belows:

<script language=”javascript” type=”text/javascript”>

$(document).ready(
function()
{
showMsg();
}
);

function showMsg()
{
// your code here
}

</script>

The above is also a replacement of the old body onload property: <body onload=”javascript showMsg()”> thing