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/ } ); 
转载于猿2048:→《js(jquery)绑定点击事件》

评论

暂无评论