jquery 选择元素的问题
HTML code
<dd><a href="javascript:void(0)">London</a></dd>
<dd><a href="javascript:void(0)">Bath</a></dd>
<dd><a href="javascript:void(0)">Bristol</a></dd>
<dd><a href="javascript:void(0)">Cornwall</a></dd>
<dd><a href="javascript:void(0)">Exeter</a></dd>
<dd><a href="javascript:void(0)">Plymouth</a></dd>
JScript code
var tcity="London";
如何选择链接文字=London的链接?
------解决方案--------------------
<dd><a href="javascript:void(0)">London</a></dd>
<dd><a href="javascript:void(0)">Bath</a></dd>
<dd><a href="javascript:void(0)">Bristol</a></dd>
<dd><a href="javascript:void(0)">Cornwall</a></dd>
<dd><a href="javascript:void(0)">Exeter</a></dd>
<dd><a href="javascript:void(0)">Plymouth</a></dd>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
var tcity="London";
alert( $('a').filter(':contains('+tcity+')').html() )
</script>