I have this code which has a radio button. I want to get the value of the text box and set it as the value of the selected radio button.
HTML
onsubmit="return formValidation();">
Monthly amount of
P
"text" value="">
Javascript
window.onload = function() {
var promised = document.getElementsByName("amounts");
for (var i = 0; i < promised.length; i++) {
promised[i].onclick = function() {
var rads = this.form[this.name];
for (var i = 0; i < rads.length; i++) {
var textField = this.form[rads[i].value.toLowerCase() + "Amount"];
if (textField) textField.disabled = !rads[i].checked;
}
}
}
}
No comments:
Post a Comment