<html xmlns="http://www.w3.org/1999/xhtml" ><head> <title>无标题页</title> <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript"> $(function(){ $("#up").click(function(){ var afirst=$(".imglist a:first-child").html(); alert(afirst); }); }); </script></head><body><a href="javascript:void(0);" id="up">往前走</a>
<div class="imglist">
<a href="javascript:void(0);" title='/UpLoadFiles/memberpic/2012071211033214.jpg'> 111 </a>
<a href="javascript:void(0);" title='/UpLoadFiles/memberpic/2012071211032801.jpg'> 222 </a>
<a href="javascript:void(0);" title='/UpLoadFiles/memberpic/2012071211031878.jpg'> 333 </a> <a href="javascript:void(0);" title='/UpLoadFiles/memberpic/2012071208381331.jpg'> 444 </a>
<a href="javascript:void(0);" title='/UpLoadFiles/memberpic/2012071208380428.jpg'> 555 </a>
</div>
<a href="javascript:void(0);" id="next">往后走</a></body></html>
问题是,现在只能取到 111
我想取到 :<a href="javascript:void(0);" title='/UpLoadFiles/memberpic/2012071211033214.jpg'>111</a>
求同志们赐教……
5 回答
GCT1015
TA贡献1827条经验 获得超4个赞
$.extend($.prototype, { htmlCode:function(){ var div = $('<div></div>'); this.appendTo(div); return div.html(); } });
$('#id').htmlCode();
- 5 回答
- 0 关注
- 334 浏览
添加回答
举报
0/150
提交
取消