Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery按文本查找并选择元素的父元素,但不包含 5 8. 让Identity=$(this.find(“Identity”).text()//这等于5 让widedt=$(wBody).find(“Position”).children(“Identity”).text()==Identity;_Javascript_Jquery - Fatal编程技术网

Javascript jQuery按文本查找并选择元素的父元素,但不包含 5 8. 让Identity=$(this.find(“Identity”).text()//这等于5 让widedt=$(wBody).find(“Position”).children(“Identity”).text()==Identity;

Javascript jQuery按文本查找并选择元素的父元素,但不包含 5 8. 让Identity=$(this.find(“Identity”).text()//这等于5 让widedt=$(wBody).find(“Position”).children(“Identity”).text()==Identity;,javascript,jquery,Javascript,Jquery,如果我有许多名为“Position”的元素,但任何位置都有唯一的“Identity”,例如,它的Identity现在等于5,那么如何选择“Position” 我不能使用“包含”,因为我不需要选择“55”或“85”或“15”,我只需要选择“5”我认为你的意思不是真的,是吗?那看起来一点也不像jq。你的意思是?亚历克斯,请简要说明你的问题。 <position><Identity>5</Identity></position> <position

如果我有许多名为“Position”的元素,但任何位置都有唯一的“Identity”,例如,它的Identity现在等于5,那么如何选择“Position”


我不能使用“包含”,因为我不需要选择“55”或“85”或“15”,我只需要选择“5”

我认为你的意思不是真的,是吗?那看起来一点也不像jq。你的意思是?亚历克斯,请简要说明你的问题。
<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;
var $pos5 = $("position").filter(function(){ 
  return $(this).find("Identity").text() == "5"; 
});