I have radiobuttonlist in which there is 3 items.
I have checkboxlist in which there is 5 items.
I have a button.
I want to unselect all the selected check boxes in the list when the button is clicked.
And I want to unselect the selected radiobutton in the radiobuttonlist.
How can I do this in JS
Pls help..

Your HTML button would look like this:

<input type="button" value='Uncheck' onClick="uncheck()" />

At the top of your HTML in the head section place the following code:

<SCRIPT LANGUAGE="JavaScript">
function uncheck() {
  document.myform.box1.checked = false;
  document.myform.box2.checked = false;
  document.myform.box3.checked = false;
  document.myform.box4.checked = false;
}
</script>

Make sure you substitute your check box names for box1,box2,...

If they are all the same name here is another technique for setting and unsetting all of them: Check box example

You should also look into the jQuery library.

I am not talking about checkboxes, I am talking about a checkboxlist.
There is no box names under the checkboxlist,
only the boxes are added like listitems and they dont hv any names

ALso, I am talking about a radiobuttonlist, how to write code in JS such that when the button is clicked, the selected radiobutton in the radiobuttonlist will be unselected

no, its not a ASP.NET related question.
I want to perform it in JS

If I Google "checkboxlist", all the top results refer to ASP.NET.

If this is not an ASP.NET related question, then you need to explain what you mean by the term.

Airshow

Member Avatar

i assume this is an interview question