Javascript: Enabled / Disable radio on selected with javascript
I would like to make this form dynamic with prototype. I mean, the radio开发者_如何学Go should be disabled, but when you chose one, with js, it should turn them enabled, same way if you chose the other one, the 1st should turn disabled.
This is my HTML, but I have no idea where to start with JS to make this work, thank you
<form id="uploadForm" method="post" action="/parser/parseCurriculumVitae.do" enctype="multipart/form-data">
<fieldset>
<div id="uploadCv">
<input type="radio" id="uploadCvSelector" name="uploadFormSelector"/>
<input disabled type="file" id="uploadCv" name="uploadCv" />
</div>
<div id="pastedCv">
<input type="radio" id="pastedCvSelector" name="uploadFormSelector" />
<textarea disabled id="pastedCv" name="pastedCv" rows="8" cols="40" onclick="this.value=''">Paste your Cv Here</textarea>
</div>
<input type="submit" value="Send'em!"/>
</fieldset>
</form>
i think your request to use prototype prejudices the answer. you can do this just fine without a library.
<input type="radio" id="pastedCvSelector" name="uploadFormSelector" onclick="document.getElementById('pastedCv').disabled=false;document.getElementById('uploadCv').disabled=true;">
<textarea disabled id="pastedCv" name="pastedCv" rows="8" cols="40" onclick="this.value=''">Paste your Cv Here</textarea>
UPDATED (again)
精彩评论