The method preventDefault() of the e parameter of the JQuery event can cancel the default behavior of the object. The following code: Copy code The code is as follows: <br>$(function () { <br>$("a").click(function (e) { <br>alert($(this) .text()); <br>e.preventDefault();//Cancel the default behavior. Without this sentence, it will jump to the baidu website <br>}); <br>}); <br>< ;/script> <br></head> <br><body> <br><a href="http://www.baidu.com">baidu</a> <br>< /body> <br></html> <br> </div>