var $nodeName = "TEST_ITEM\\[@desc='item_one'\\]";http://api.jquery.com/category/selectors/ To use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[\]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes: \\. For example, an element with id="foo.bar", can use the selector $("#foo\\.bar").
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type='text/javascript'>
$(function(){
$("div.box").each(function(){
alert($(this).html());
});
})
</script><div class="box" name="TEST_ITEM[@desc='item_one']">
显示内容
</div>
<div class="box" name="TEST_ITEM[@desc='item_other']">
不获取的内容
</div>
......
<div class="box" name="TEST_TEST[@desc='item_one']">
不获取的内容
</div>
To use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[\]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes: \\. For example, an element with id="foo.bar", can use the selector $("#foo\\.bar").