向页面动态添加html标签,用Jquery live 调用其单击事件为什么进不去 ,,,求大神解决啊!!!
<!doctypehtml><html><head><metacharset="utf-8"><title>on</title><style>.a{width:300px...
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>on</title>
<style>
.a{
width:300px;
height:33px;
background:#0cf;
border-radius:5px;
cursor:pointer;
}
#b{
display:flex;
}
</style>
<script src="../js/jquery.min.js"></script>
<script>
$(function(){
$('.a').live('click',function(){
$(this).append('<div id="b"><img src="../img/expression/4.gif"><div class="c">确认贵港市</div></div>');
});
$('#b c').live('click',function(){
alert();
$(this).append("<div class='answer'><img src='../img/expression/9.png'></div>");
})
});//end ready
</script>
</head>
<body>
<div class="a"></div>
</body>
</html> 展开
<html>
<head>
<meta charset="utf-8">
<title>on</title>
<style>
.a{
width:300px;
height:33px;
background:#0cf;
border-radius:5px;
cursor:pointer;
}
#b{
display:flex;
}
</style>
<script src="../js/jquery.min.js"></script>
<script>
$(function(){
$('.a').live('click',function(){
$(this).append('<div id="b"><img src="../img/expression/4.gif"><div class="c">确认贵港市</div></div>');
});
$('#b c').live('click',function(){
alert();
$(this).append("<div class='answer'><img src='../img/expression/9.png'></div>");
})
});//end ready
</script>
</head>
<body>
<div class="a"></div>
</body>
</html> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询