I am new to JQuery and am racking my brain trying to understand why this one code works, but mine does not. Here is a snippet...
window.onbeforeunload = function(event) {
$('#mqTable tr.group1').css("background-color", "pink"); // This works
$('#mqTable tr.group1').changeColor(); // Trying my own function fails
// Prevent the warning message when leaving the page
// event.preventDefault();
event.returnValue = "To be removed...";
};
jQuery.fn.extend({
changeColor: function() {
$(this).css("background-color", "pink");
return $(this);
}
});
So, I am trying to create my own custom function, but I am doing something wrong. Any ideas?