close
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<style type="text/css">
#btn{
background-color: #0ef;
padding: 20px;
width: 300px;
}
li{
margin: 10px 0;
}
</style>
</head>
<body>
<ul id="btn"><li>按我</li> <li id="nono">按我沒反應喔</li></ul>
<div id="result"></div>
<script type="text/javascript">
$('#btn').on('click',':not(#nono)',{status:'被按下去囉'},function(e){
$('#result').html(
'<h3>按鈕上的文字:'+e.target.textContent+'</h3>'+
'<h3>按鈕的狀態:'+e.data.status+'</h3>'+
'<h3>按鈕綁定的事件:'+e.type+'</h3>'
);
});
</script>
</body>
</html>
全站熱搜
留言列表