JS/JQuery - Events
List of useful events for JS and JQuery.
Listed in the order of execution in the browser.
//$(window).bind('beforeunload', function () { }); // in jquery
var hasChanges = true;
window.onbeforeunload = function () {
if (hasChanges) return ""; // only asks if hasChanges == true
}
document.onreadystatechange = function () {
console.log("2 - document.readyState=" + document.readyState);
}
$(function () {
console.log("3 - null");
});
$(document).ready(function () {
console.log("4 - ready");
});
document.onreadystatechange = function () {
console.log("5 - document.readyState=" + document.readyState);
}
//$(window).bind("load", function () { }); // other way
//$(window).on("load", function () { }); // other way
$(window).load(function () {
console.log("6 - load");
});
$.get("", function (data) {
console.log("7 - get");
});
Listed in the order of execution in the browser.
//$(window).bind('beforeunload', function () { }); // in jquery
var hasChanges = true;
window.onbeforeunload = function () {
if (hasChanges) return ""; // only asks if hasChanges == true
}
document.onreadystatechange = function () {
console.log("2 - document.readyState=" + document.readyState);
}
$(function () {
console.log("3 - null");
});
$(document).ready(function () {
console.log("4 - ready");
});
document.onreadystatechange = function () {
console.log("5 - document.readyState=" + document.readyState);
}
//$(window).bind("load", function () { }); // other way
//$(window).on("load", function () { }); // other way
$(window).load(function () {
console.log("6 - load");
});
$.get("", function (data) {
console.log("7 - get");
});
Comments
Post a Comment