简体   繁体   中英

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). 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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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