1. 含义: preventDefault() 方法阻止元素发生默认的行为(例如,当点击提交按钮时阻止对表单的提交)。
2. 语法:
event.preventDefault()
3. 例子:
防止链接打开 URL: $("a").click(function(event){ event.preventDefault(); });
1. 含义: preventDefault() 方法阻止元素发生默认的行为(例如,当点击提交按钮时阻止对表单的提交)。
2. 语法:
event.preventDefault()
3. 例子:
防止链接打开 URL: $("a").click(function(event){ event.preventDefault(); });
转载于:https://www.cnblogs.com/blogofwyl/p/4538786.html