代码:
var d5=$("<div>").attr("class","catX");
var sp=$("<span>").attr("class","task-people-tabitem");
$("<img>").attr("class","btnR right").attr("src","images/buttons-icons/icon_closesearch.png").width("20").height("20").appendTo(sp);
sp.appendTo(d5);
插入此element后,通过$(".task-people-tabitem") 无法获取对象及触发click事件,如何解决?
谢谢。jqueryhtmldiv
var d5=$("<div>").attr("class","catX");
var sp=$("<span>").attr("class","task-people-tabitem");
$("<img>").attr("class","btnR right").attr("src","images/buttons-icons/icon_closesearch.png").width("20").height("20").appendTo(sp);
sp.appendTo(d5);
插入此element后,通过$(".task-people-tabitem") 无法获取对象及触发click事件,如何解决?
谢谢。jqueryhtmldiv
<script type="text/javascript">
var d5=$("div").attr("class","catX");
var sp=$("span").attr("class","task-people-tabitem");
$("img").attr({class:"btnR right",src:"images/buttons-icons/icon_closesearch.png"}).css({width:20,height:20}).appendTo(sp);
sp.appendTo(d5);
</script>