Re: Having a checkbox make something available when it's checked.
- From: David R. Longnecker <dlongnecker@xxxxxxxxxxxxxxxx>
- Date: Wed, 26 Mar 2008 14:39:34 +0000 (UTC)
Jeff-
The Ctl00$... isn't necessary (as far as I know) on either of the browsers; that's the control hierarchy generated by .NET. getElementById should be able to find the control simply by it's Id attribute.
<div>
<input type="checkbox" onclick="javascript:document.getElementById('btnToCheckOut').disabled=!this.checked; return true;" />Accept?
<button id="btnToCheckOut" disabled="disabled">Checkout</button>
</div>
Tested in FF2, IE7, and Safari and works just fine.
HTH.
-dl
--
David R. Longnecker
http://blog.tiredstudent.com
I have a check box with javascript code attached to it that will allow
me to enable an 'accept' butten when the person has checked the box.
The code is:
input type="checkbox" name="checkbox"
onclick="javascript:document.getElementById('ctl00$MainPage$btnToCheck
out').disabled=!this.checked; return true; " />I
The code works fine in IE - the button becomes enabled when the check
box is clicked. But if Firefox it doesn't work.
Any thoughts?
TIA - Jeff.
.
- Follow-Ups:
- References:
- Prev by Date: Re: TreeView Dynamic XML Binding
- Next by Date: Re: TreeView Dynamic XML Binding
- Previous by thread: Having a checkbox make something available when it's checked.
- Next by thread: Re: Having a checkbox make something available when it's checked.
- Index(es):
Loading