I have a textbox which is disabled by default… the onclick works and enables it to be typed in, but when i click the radio button away.. it doesn’t disable the textbox again
Any clues ?
<input type="radio" name="group1" value="website" OnBlur="javascript:document.getElementById('websiteurl').disabled = true;" OnClick="javascript:document.getElementById('websiteurl').disabled = false;">
<input name="websiteurl" type="text" id="websiteurl" value="http://" size="50" disabled="true" />
Thanks in advance
Lee
There is no attribute
enabled. You usedisabledand set it totrueorfalse.Besides that:
Use lowercase attributes (otherwise it’s not valid XHTML); there’s no need to put
javascript:in front of it.Additionally, it is better to attach events from JavaScript code instead of inlining them. Especially if you use a library like jQuery it’s extremely easy:
(of course a
#idwould be much better instead of theinput[name=group1][value=website]selector)