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

.net - Transaction locking an Insert statement -

clojure - Best way to lazily collapse multiple contiguous items of a sequence into a single item -

remove Repeat values from a list in haskell -