Hi.
I have several radiobuttonlist objects in my asp.net page (.aspx), each with a button next to it. When the user clicks one of the buttons, the radiobuttonlist next to it clears. I am able to do this by creating a javascript function for each button/radiobuttonlist pair, but I can't seem to modify that function properly so that I have just one function with a parameter instead that gets called from each one of the buttons. Here is the function for a radiobuttonlist object called "rbl1:
function clearRadioButtonList1() {
var elementRef = document.getElementById('<%= rbl1.ClientID %>');
var inputElementArray = elementRef.getElementsByTagName('input');
for (var i = 0; i < inputElementArray.length; i++) {
var inputElement = inputElementArray;
inputElement.checked = false;
}
return false;
}
Can someone please show me how to change the function so that it uses a parameter and also what the call to the function should look like on the buttons?
Thanks for your help!
I have several radiobuttonlist objects in my asp.net page (.aspx), each with a button next to it. When the user clicks one of the buttons, the radiobuttonlist next to it clears. I am able to do this by creating a javascript function for each button/radiobuttonlist pair, but I can't seem to modify that function properly so that I have just one function with a parameter instead that gets called from each one of the buttons. Here is the function for a radiobuttonlist object called "rbl1:
function clearRadioButtonList1() {
var elementRef = document.getElementById('<%= rbl1.ClientID %>');
var inputElementArray = elementRef.getElementsByTagName('input');
for (var i = 0; i < inputElementArray.length; i++) {
var inputElement = inputElementArray;
inputElement.checked = false;
}
return false;
}
Can someone please show me how to change the function so that it uses a parameter and also what the call to the function should look like on the buttons?
Thanks for your help!