How to enable and disable various components in jQuery Mobile? Following are my tips.
To disable a button, simply add the ‘disabled‘ attribute to it:
The same applies to a submit button. Adding the ‘disabled‘ attribute to the submit button disables it.
As far as link button is concerned, since anchors don’t natively have any disabled state, jQuery Mobile group decides not to support disable and enable anchors like buttons. Therefore, we have to apply ‘ui-disabled’ class to the anchor to achieve the same effect.
It’s extremely easy to disable form components by just adding ‘disabled‘ attribute to them.
The display looks like below:
Or we’re able to disable the entire form by adding ‘ui-disabled‘ class to it:
Through this way, the labels inside the form are dimmed too.