js(jquery)绑定点击事件

<button type="submit" id="test">test</button>

第一种

$("#test").click(function(event){
/* Act on the event */});

第二种

document.getElementById('#foo').addEventListener('click', function() {
/* Act on the event */}, false);

第三种

html

     <button type="submit" id="test" onclick="test()">test</button>

js

     function test(){/* Act on the event */}

第四种

$('#test').bind('click', function() {/* Act on the event */ });

第五种

$( "#test" ).on( "click", function() {/* Act on the event*/ } ); 

原文地址:https://www.cnblogs.com/itsmart/p/8030121.html