javascript - Is it possible to change a .click() function in JQuery? -
if have .click() function in header of page, possible overwrite later in page?
for example if have in header:
<script> $("document").ready(function() { $("a.lol").click(function () { alert("aaa"); }); }); </script> would possible change $("a.lol") alert else, , not alert "aaa"?
try this,
$("document").ready(function() { $("a.lol").click(function () { // click event alert("aaa"); }); $("a.lol").off('click');// off click event $("a.lol").on('click',function () { // again bind new click event on() alert("new click"); }); });
Comments
Post a Comment