fire an event after document is rendered
How to fire an event or开发者_C百科 call a method after the document body is fully rendered in jQuery
With respect to your clarification in the comment:
It depends on how you generate the table (more information would be good). But in general, no, there is no event for that. You have to call the function when you finished building the table.
buildTable();
hideControls();
If you use Ajax for building the table, then you have to hide the controls inside the callback for the Ajax request.
Update:
You could also consider to use a different CSS stylesheet for that page which hides the control elements.
Try binding an event on load in your ready function:
$(function(){
$(window).load(function(){
// Do stuff after everything has been loaded
});
});
http://api.jquery.com/load-event/
You can use a combination of JQuery events to do this (http://api.jquery.com/category/events/). What worked for me was to create 2x handlers for the "ready" event. The first initializes the doc and loads the contents (using KnockoutJS bindings). The second fires jscript code to render canvas controls that were created by the first.
$(document).ready(function(){
//document fully loaded
$('#subbtn').click(); // fire the click event on a form button
});
精彩评论