The disable attribute in option tag not working
Place to talk about website HTM elements, CSS style and design, and get help with HTML, CSS codes.
-
Marius
- Posts: 106
The disable attribute in option tag not working
I have designed a html page, but in option tag I have set
disabled="true", still it is not disabling the option.
Things I have tried:
Code: Select all
disabled="true"
disabled="disabled"
And in JS with jQuery:
Here is my html code:
Code: Select all
<select name="selectcountry1" id="c1">
<option value="select" class="dis" disabled="true" selected>Select Country 1</option>
<option value="India">India</option>
<option value="Australia">Australia</option>
<option value="England">England</option>
<option value="NewZealand">New Zealand</option>
<option value="SouthAfrika">South Afrika</option>
<option value="WestIndies">West Indies</option>
<option value="Pakistan">Pakistan</option>
<option value="SriLanka">Sri Lanka</option>
<option value="Bangladesh">Bangladesh</option>
<option value="Afganistan">Afganistan</option>
</select>
Is there any other way to disable those options?
Admin
The attribute
disabled sets without value (without
='true'). You need just add this attribute into the options you want disabled.
Code: Select all
<option value="select" class="dis" disabled>
for setting this attribute on JavaScript with jQuery, you need to write something like this:
for check option to disabled:
Code: Select all
if ($('option.dis').prop('disabled') === true)
Similar Topics
-
FTM2S Disable Login
Scripts from this website
First post
Really like the simplicity of FTM2S: coursesweb.net/php-mysql/ftm2s-file-transfer-manager-two-servers
Since using on a closed network and not...
Last post
Excellent! Works great, thank you.
-
Link to part of another page (not working)
PHP - MySQL
First post
I`m searching for few hours now but can`t find a solution to link to a part off a page ??? I try to use this...
In one comment-page I have this...
Last post
It is strange I tried alot things nothing working correctly.
Meight my Question is wrong, Because I try from a page a link to another page but the...
-
Display selected option into a Div
JavaScript - jQuery - Ajax
First post
How can I make that when an option from dropdowna <select> list is selected, the value of that option be displayed into a Div.
I have this...
Last post
You have to start with a <select> element which raises a 'change' event when an option is selected.
Inside that event, 'this.value' refers to...