How to enable or disable an anchor using jQuery?
问题 How to enable or disable an anchor using jQuery? 回答1: To prevent an anchor from following the specified href , I would suggest using preventDefault(): // jQuery 1.7+ $(function () { $('a.something').on("click", function (e) { e.preventDefault(); }); }); // jQuery < 1.7 $(function () { $('a.something').click(function (e) { e.preventDefault(); }); // or $('a.something').bind("click", function (e) { e.preventDefault(); }); }); See: http://docs.jquery.com/Events/jQuery.Event#event.preventDefault