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

java - How to pass parameters between Request-Scoped Controllers? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -

ms access - C# - Using OleDbParameter on table name -