I'm using Bootstrap css and js in my application. Accidentally I clicked on a disabled Dropdown list and found that it's opening the dropdown. I have made it readonly
in the attribute of the select
element:
<select id="xxx" name="xxx" class="input-medium" readonly>
I have also tried setting readonly="true"
, but still the same.
However, textbox control works fine, if you don't use jQuery.datepicker.
Is there a special way of making a dropdown control readonly when we use bootstrap?
To disable a button using only JavaScript you need to set its disabled property to false . For example: element. disabled = true . And to enable a button we would do the opposite by setting the disabled JavaScript property to false .
Add data-toggle="buttons" to a . btn-group containing those modified buttons to enable their toggling behavior via JavaScript and add . btn-group-toggle to style the <input> s within your buttons. Note that you can create single input-powered buttons or groups of them.
Use the . btn-sm class in Bootstrap to create a small button.
Answer: Use the text-right Class You can simply use the class . text-right on the containing element to right align your Bootstrap buttons within a block box or grid column. It will work in both Bootstrap 3 and 4 versions.
No, Bootstrap does not introduce special considerations for disabling a drop-down.
<select id="xxx" name="xxx" class="input-medium" disabled>
or
<select id="xxx" name="xxx" class="input-medium" disabled="disabled">
will work. I prefer to give attributes values (as in the second form; in XHTML, attributes must have a value), but the HTML spec says:
The presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value.
(from http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#boolean-attribute)
The key differences between read-only and disabled:*
The Disabled attribute
The Read Only Attribute
<SELECT>
, <OPTION>
, and <BUTTON>
elements do not have readonly attributes (although thy both have disabled attributes)*-blatant plagiarism from http://kreotekdev.wordpress.com/2007/11/08/disabled-vs-readonly-form-fields/
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