Binding Events (js) and distribute event (jquery)

Creative Commons License Copyright: Attribution, allow others to create paper-based, and must distribute paper (based on the original license agreement with the same license Creative Commons )

Binding Events (js):

Binding events, as opposed to native js speaking of. Do a simple binding events, easy to understand.

​
function Bd(){//写在按钮的上面下面都可以
   alert("我是绑定事件");
}

input type="button" value="绑定事件" id="btn" onclick="Bd()">

​

Distribute event (jquery):

Event dispatcher, it is relative to the jquery. For a small demo dispatch events.

 $("#btn1").click(function(){
   	alert("事件的派发")
 })//写在按钮上面需要页面的加载

 <input type="button" value="派发事件" id="btn1">//按钮,不需要在标签内加上点击事件。

 $("#btn1").click(function(){
   	alert("事件的派发")
 })//写在按钮下面不需要页面的加载

 

Guess you like

Origin blog.csdn.net/longyanchen/article/details/93188668
Recommended