Pain Posted July 23, 2013 Share Posted July 23, 2013 Hi. I want to get an element by id with a value, instead of just id. <input name="select_one" type="radio" value="METRO" id="radio" onClick="if(this.checked) document.getElementById('service14').disabled=true;" /> so here instead of disabling an element with id 'service14', i would like to disable an element with that id AND a value (let's say 'abc'). What do i need to change in that line? Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/280430-get-element-by-id-with-particular-value/ Share on other sites More sharing options...
requinix Posted July 23, 2013 Share Posted July 23, 2013 1. Don't put complicated code in an onclick 2. In fact avoid using onclick attributes and instead attach event handlers 3. if thing is checked { obj = get the object if obj value is "abc" { disable obj } } Quote Link to comment https://forums.phpfreaks.com/topic/280430-get-element-by-id-with-particular-value/#findComment-1441820 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.