Is there a simple Javascript or JQuery way to make a textbox disabled WITHOUT using the attribute disabled?
We are using Handlebar.js and when a disabled field is found it skips the field when its serialized so we can't use the disabled attribute. Is there a way to make the textbox uneditable still? Perhaps with a focus or blur?
Use readonly
attribute instead :
$('#textBox').prop('readonly', true);
Use .attr() instead of .prop() if you're using jQuery < 1.9
directly add "readonly" attribute to the input element like this
Name: <input type="text" value="editing me is disabled" readonly>
It works like charm. No need of using jquery for that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With