I ve got an ASP.NET control that contains a checkbox. I want the focus to remain on this checkbox when it s clicked. Here s what I m using:
<script type="text/javascript">
window.addEvent("domready", function() {
var acceptCheckId = $("<%= this.accept.ClientID %>").getElement("input");
acceptCheckId.addEvent("click", function() {
acceptCheckId.focus();
});
});
</script>
I can get the checkbox element into the acceptCheckId
variable okay, but when I click on it, the focus doesn t change. What gives?
If I add an alert in, the alert never fires:
acceptCheckId.addEvent("click", function() {
alert("foobar");
acceptCheckId.focus();
});