Example uses of $(document).ready()
:
$(document).ready(function() {
$("button").click(function() {
// Code for the click function
});
});
jQuery(function($) {
// set the value of an element.
$("#myElement").val("Hello");
});
div
when the page loads for the first time
and show it on the click event of a button$(document).ready(function() {
$("#toggleDiv").hide();
$("button").click(function() {
$("#toggleDiv").show();
});
});