Bootstrap 4 Input Control - readOnly property


#1

I’m having a problem with the readOnly property with the Bootstrap 4 input control. If I change the property at runtime it has no effect - it always uses whatever the property was set to at design time. If I watch in the debugger the property does get set properly, but it has no effect on whether or not I can enter data into the control.


#2

Try this:

$("#Input1_contents").attr("readonly", "readonly")

This uses jQuery’s attr function to add the readonly attribute to the actual input element, which is contained inside the the Input1 control.


#3

That seems to work to turn readOnly on - how do I turn it off?


#4

Is this the proper format?
("#Input1_contents").attr(“readonly”, true) or ("#Input1_contents").attr(“readonly”, false) ??

Will the readOnly property be fixed in a future release?


#5

Yes, true/false will work.

We don’t have plans to add a helper function for this - but if we hear from enough people, we will have another look.