如何选择给定类型中最接近的元素,而该元素位于给定类型的元素之上?
this
当前为
$('#j1_95_anchor')
,我希望选择
<li>
身份证是
15.0
. 注意,我目前没有这个id值。
<ul role="group" class="jstree-children" style="">
<li role="treeitem" aria-selected="false" aria-level="3"
aria-labelledby="15.0_anchor" aria-expanded="true" id="15.0" class="jstree-node jstree-open" aria-busy="false"><i class="jstree-icon jstree-ocl" role="presentation"></i><a class="jstree-anchor" href="#" tabindex="-1" id="15.0_anchor"><i class="jstree-icon jstree-themeicon" role="presentation"></i>Volts_AB</a>
<ul role="group" class="jstree-children" style="">
<li role="treeitem" aria-selected="false" aria-level="4" aria-labelledby="j1_90_anchor" id="j1_90" class="jstree-node jstree-leaf"><i class="jstree-icon jstree-ocl" role="presentation"></i><a class="jstree-anchor" href="#" tabindex="-1" id="j1_90_anchor"><i class="jstree-icon jstree-themeicon" role="presentation"></i>ID: 15</a></li>
<li role="treeitem" aria-selected="false"
aria-level="4" aria-labelledby="j1_91_anchor" id="j1_91" class="jstree-node jstree-leaf"><i class="jstree-icon jstree-ocl" role="presentation"></i><a class="jstree-anchor" href="#" tabindex="-1" id="j1_91_anchor"><i class="jstree-icon jstree-themeicon" role="presentation"></i>Name: Volts_AB</a></li>
<li role="treeitem" aria-selected="false"
aria-level="4" aria-labelledby="j1_92_anchor" id="j1_92" class="jstree-node jstree-leaf"><i class="jstree-icon jstree-ocl" role="presentation"></i><a class="jstree-anchor" href="#" tabindex="-1" id="j1_92_anchor"><i class="jstree-icon jstree-themeicon" role="presentation"></i>Description: Voltage Phase A-B</a></li>
<li role="treeitem"
aria-selected="false" aria-level="4" aria-labelledby="j1_93_anchor" id="j1_93" class="jstree-node jstree-leaf"><i class="jstree-icon jstree-ocl" role="presentation"></i><a class="jstree-anchor" href="#" tabindex="-1" id="j1_93_anchor"><i class="jstree-icon jstree-themeicon" role="presentation"></i>Units: volts</a></li>
<li role="treeitem" aria-selected="false"
aria-level="4" aria-labelledby="j1_94_anchor" id="j1_94" class="jstree-node jstree-leaf"><i class="jstree-icon jstree-ocl" role="presentation"></i><a class="jstree-anchor" href="#" tabindex="-1" id="j1_94_anchor"><i class="jstree-icon jstree-themeicon" role="presentation"></i>Type: Analog Input</a></li>
<li role="treeitem" aria-selected="true"
aria-level="4" aria-labelledby="j1_95_anchor" id="j1_95" class="jstree-node jstree-leaf jstree-last">
<i class="jstree-icon jstree-ocl" role="presentation"></i>
<a class="jstree-anchor addPoint editable editable-click jstree-clicked" href="#" id="j1_95_anchor" data-original-title="" title=""><i class="jstree-icon jstree-themeicon glyphicon glyphicon-plus-sign jstree-themeicon-custom" role="presentation"></i>Add Point</a>
</li>
</ul>
</li>
</ul>
$(this).closest('ul').closest('li');
$(本).最近('ul>李');