简体   繁体   English

在IE8中获取具有特定值的输入元素?

[英]Get an input element with specific value in IE8?

I need to select an item with an id value that is not always the same (depending on amount of radio buttons set by Code Behind of ASP.NET WebForms). 我需要选择一个id值并不总是相同的项(取决于ASP.NET WebForms的Code Behind设置的单选按钮的数量)。 What is unique is the valuethat belongs to the input field. 唯一的是属于输入字段的值。

<input id="ctl00_ContentPlaceHolder1_RadioButtonList_2" type="radio" 
    name="ctl00$ContentPlaceHolder1$RadioButtonList" value="21" />

How can I obtain this input element with JavaScript that works in IE8? 如何使用可在IE8中使用的JavaScript获取此输入元素?

Yes, It is possible. 对的,这是可能的。 You can do it by following way:- 您可以按照以下方式进行:

$(function(){
    element = $('input[value="The unique value"]');
    /*do whatever you want with this element*/
});

follow this answer for more info: jquery find element by text 遵循此答案以获取更多信息: jQuery按文本查找元素

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM