javascript - Why embedding jQuery code into $(function())? -



javascript - Why embedding jQuery code into $(function())? -

i used different jquery plugins , in cases not working (or not working @ all) until embedded them $(function({ ... })).

as illustration plugin:

$('#datetextbox').datetimepicker();

does not work, if in plugin web site used in same form. placing within $(function()) turns working perfectly:

$(function () { $('#datetextbox').datepicker(); });

what statement "$(function ())" brings exactly? tried search in same jquery web site did not find answer.

what statement "$(function ())" brings exactly?

it makes sure code not executed before page has finished loading. shorthand for

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

read: http://api.jquery.com/ready/

javascript jquery jquery-plugins

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -