jaydeep
answered Nov 30 '-1 00:00
in jQuery , document ready is good function to avoid problem where apply code on not loaded dom element
document.ready run enclosed javascript or jquery code after dom rendering
$( document ).ready(function() {
alert( "hello" );
});
in above code , it will display alert with message "hello" after HTML page dom ready
short hand of document.ready :
$(function() {
alert( "hello" );
});
above code also work same as document.ready , $(function() { is short hand code for $( document ).ready(function() {
so above code will show alert box after page load completion and HTML DOM ready