D
dougloj
I'm developing an ASP.Net application that uses checkboxes. I am trying
to use client-side Javascript to capture the clicking of a checkbox
when it happens via the OnClick event.
In my .aspx file, I might have the checkbox coded as follows:
<asp:CheckBox onclick="SeeClick(this);" AutoPostBack="False"
Visible="True" ID="CheckBox1" Text="Selection1"
runat="server"></asp:CheckBox>
The HTML that gets sent to the browser for this is:
<span onclick="SeeClick(this);"><input id="CheckBox1" type="checkbox"
name="CheckBox1" /><label for="CheckBox1">Selection1</label></span>
In my Javascript SeeClick function, I do a few things to see if the
actual checkbox has been checked or not. That's fine. But if the user
clicks on the label next to the checkbox, the SeeClick function is
called twice, and that screws things up, because on one of the calls, I
get an invalid reading of the "checked" attribute. I have no way of
knowing if the user clicked the checkbox or the lable.
Does anybody have any ideas on how to deal with this? Thanks in
advance.
- Doug
to use client-side Javascript to capture the clicking of a checkbox
when it happens via the OnClick event.
In my .aspx file, I might have the checkbox coded as follows:
<asp:CheckBox onclick="SeeClick(this);" AutoPostBack="False"
Visible="True" ID="CheckBox1" Text="Selection1"
runat="server"></asp:CheckBox>
The HTML that gets sent to the browser for this is:
<span onclick="SeeClick(this);"><input id="CheckBox1" type="checkbox"
name="CheckBox1" /><label for="CheckBox1">Selection1</label></span>
In my Javascript SeeClick function, I do a few things to see if the
actual checkbox has been checked or not. That's fine. But if the user
clicks on the label next to the checkbox, the SeeClick function is
called twice, and that screws things up, because on one of the calls, I
get an invalid reading of the "checked" attribute. I have no way of
knowing if the user clicked the checkbox or the lable.
Does anybody have any ideas on how to deal with this? Thanks in
advance.
- Doug