日期:2014-05-16  浏览次数:20497 次

jquery如何添加指定标签到某值之后
长话短说
例如
HTML code
<ul class="a" v=1">
<li>abc</li>
<li>abc</li>
<li>abc</li>
</ul>
<ul class="a" v=2">
<li>abc</li>
<li>abc</li>
<li>abc</li>
</ul>
<ul class="a" v=3">
<li>abc</li>
<li>abc</li>
<li>abc</li>
</ul>
<a href="javascript:void(0)" class="two">添加分类</a>


jquery
JScript code
&(document).ready(function(){
$('.two').click(function(){
var addstr='';
addstr+="<ul class=\"a\">"
addstr+="<li>abc</li>"
addstr+="<li>abc</li>"
addstr+="<li>abc</li>"
addstr+="</ul>"
$(addstr).insertAfter();//这里我想添加到V=1之后,该怎么写???
});
});


------解决方案--------------------
code=JScript]
$("#ul[v='1']").after(addstr);
[/code]
------解决方案--------------------
探讨

code=JScript]
$("#ul[v='1']").after(addstr);
[/code]