Reputation: 1129
I have a conditional statement that does this if a condition is met. My if statement is fine, everything else works perfectly. The idea is that if a certain checkbox is ticked, one of the text input will be set to a certain value and become uneditable. I am having problems with this line. Is there a better way to do this? I cannot figure out what's wrong!
document.getElementById('amount').onfocus = "this.blur()";
Upvotes: 1
Views: 353
Reputation: 2902
try
onFocus = function(){return false;}
or you can use the readonly attribute in your input tag. But i'm not sure if it work in all browsers.
Upvotes: 1