jQuery通过文本查找并选择元素的父级但不包含

时间:2018-03-26 18:05:05

标签: javascript jquery

<position><Identity>5</Identity></position>
<position><Identity>8</Identity></position>
let Identity = $(this).find("Identity").text(); //this equal 5
let wIdent = $(wBody).find("Position").children("Identity").text() == Identity;

我如何选择&#34;位置&#34;,如果我有许多带名称的元素&#34;位置&#34;,但任何位置都有唯一的&#34;身份&#34;,例如其身份现在等于5。

我无法使用&#34;包含&#34;因为我不需要选择&#34; 55&#34;或&#34; 85&#34;或&#34; 15&#34;,我只需要选择&#34; 5&#34;

1 个答案:

答案 0 :(得分:2)

sql injections