jQuery 事件

jQuery是为事件处理特别设计的

jQuery处理方法是jQuery中的核心函数

jQuery函数一般放在<head>部分的事件处理方法中

举例:当按钮被点击时会触发一个jQuery函数,隐藏P标签里的内容,请看代码。这就是一个事件函数

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
    $("p").hide();
  });
});
</script>
</head>

<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me</button>
</body>

</html>
原文地址:https://www.cnblogs.com/275147378abc/p/4511167.html