alkindyss Posted December 5, 2005 Share Posted December 5, 2005 check this code, i dont know whats wrong. it should disable the text box when i click on the checkbox but it doesnt, please help. <html><body><input type="checkbox" id="check1"><input type="text" id="bla"><script type="text/javascript">if (document.getElementById('check1').value == true){ document.getElementById('bla').disabled = true} </script></body></html> Link to comment Share on other sites More sharing options...
aspnetguy Posted December 5, 2005 Share Posted December 5, 2005 try this <html><head><script type="text/javascript"> function setState(elemId, targetId) { if (document.getElementById(elemId).checked == true) { document.getElementById(targetId).disabled = true; } else { document.getElementById(targetId).disabled = false; } }</script></head><body><input type="checkbox" id="check1" onclick="setState(this.id,'bla')"><input type="text" id="bla"></body></html> Link to comment Share on other sites More sharing options...
alkindyss Posted December 7, 2005 Author Share Posted December 7, 2005 It worked out! Many Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now