I have a problem where the $().ready is triggering no matter what I put into the parameter which means that it actually triggers before the page is ready. I am using ASP.NET mixed in with EXT.NET and would like to implement jQuery to spice things up a little. As the description says, it triggers no matter what so if I put “123” into the paramter it will show me the alart() anyways. Here is the code is am running:
$("123").ready(function () {
var $kids = $("x-column-inner").children();
alert($(".x-column-inner").height());
});
As a result “.x-column-inner” is null because it hasn’t finished compiling the page and is already executing the javascript.
The
.readymethod ignores what is in the selector completely. It is only fired when theDOMContentLoadedevent is triggered by the browser.Note however that DOMContentLoaded may fire before images and css sheets are done loading, resulting in in-accurate height and width measurements. If that is an issue for you, you need to use
$(window).load();If the
DOMContentLoadedevent has already been triggered, the ready callback will be executed immediately.