Hi
I’m creating a search page that enables the user to make multi choices.
So I have to do it with CheckBoxList
like that
<asp:CheckBoxList ID=”CheckBoxList1″ runat=”server”>
<asp:ListItem Value=”0″>None</asp:ListItem>
<asp:ListItem Value=”1″>English</asp:ListItem>
<asp:ListItem Value=”2″>German</asp:ListItem>
<asp:ListItem Value=”3″>French</asp:ListItem>
</asp:CheckBoxList>
what I want is when I click on “None” option it clears all other options
and if I click on any other option like (“English” or “German” or “French”) it clears the “None” option
I have 5 CheckBoxLists on my page
and I Work under MasterPage
I had this code with jquery but I don’t know what the problem here
<asp:Content ID=”Content1″ ContentPlaceHolderID=”ContentPlaceHolder1″ Runat=”Server”>
<script src=”
<script type=”text/javascript”>
//function doHourglass() { document.body.style.cursor = ‘wait’; }
$(document).ready(function(){
$(“INPUT[name=’CheckBoxList1′]”).click(function(){
if($(this).is(‘:checked’)){
if($(this).val()==”0″){
$(“INPUT[name=’CheckBoxList1′]”).each(function(){
if($(this).val()!=”0″){ $(this).attr(‘checked’,false); }
});
}
else
{
$(“INPUT[name=’CheckBoxList1′]:first”).attr(‘checked’,false);
}
}
});
});
</script>
<asp:CheckBoxList ID=”CheckBoxList1″ runat=”server” >
<asp:ListItem Value=”0″>None</asp:ListItem>
<asp:ListItem Value=”1″>English</asp:ListItem>
<asp:ListItem Value=”2″>German</asp:ListItem>
<asp:ListItem Value=”3″>French</asp:ListItem>
</asp:CheckBoxList>
</asp:Content>
please could you help me to find the problem
Your help will be appreciated