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)绑定点击事件》
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论