<style type=”text/css”>
.parent{
width:160px;
height:160px;
border:1px solid green;
font-size:12px;
}
.children{
width:100px;
height:100px;
border:1px solid red;
}
span{background-color:green;}
</style>
<script type=”text/javascript” src=”mytest/jQuery/jquery-1.8.3.js”></script>
<script type=”text/javascript”>
$(document).ready(function(){
var newtext=”这是新文本”
$(“.parent”).on(“click”,”.children”,{“mytext”:newtext},function(e){
$(this).text(e.data.mytext);
})
})
</script>
</head>
<body>
<div class=”parent”>
<div class=”children”><span>原来内容</span></div>
</div>
<span>大家好</span>
</body>
</html>
以上代码通过通过选择器字符串来过滤匹配元素的子元素中哪些可以响应绑定的事件。上面的代码中,类名为children的元素和它的子元素可以调用绑定的事件。
语法结构二:
$(selector).on(object,[selector],[data])
参数列表:










