选择同一节点上的上一个控件的第一个隐藏的输入元素 [英] select first hidden input element of the previous control on the same node
问题描述
在上面您可以看到我的DOM,如何从a标签获得输入,如下所示.请注意,该部分重复多次,因为它是从中继器控件中派生的.
Above you can see my DOM , how do I get to the input from the a tag as shown below. Note that the portion is repeated multiple times as it is derived from a repeater control.
我早些时候确实发布了一个类似的问题,由于该问题似乎令人困惑,我已将其标记为删除.
I did post a similar question earlier , which I have flagged for deletion as the question seems to be confusing.
目标是一个隐藏字段,并假设我只知道ID的后缀为"AID".那么我该如何选择呢?
The target is a hidden field, and assume that I only know that the ID is suffixed with "AID". So how can i select it ?
这是我尝试过的方法,但是我知道它是错的
here is what i have tried , but i know its wrong though
var AnsID = $('*:hidden:first[id*="AID"]').prev("div");
任何帮助表示赞赏的人.谢谢!
any help appreciated guys. thanks!
推荐答案
$(this).prev('div').children('input[id*="AID"]:hidden:first');
其中this
是a
标记.
如您所见,我选择了上一个div
元素,然后访问id
属性中包含aid
的第一个隐藏输入子级.
As you can see, I select the previous div
element, then I access the first hidden input child that contains aid
in the id
attribute.
这应该有效.
这篇关于选择同一节点上的上一个控件的第一个隐藏的输入元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!