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:107
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
Posts:805
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
- XAMPP-server only local host working
General Forum
First post
Dear Coursesweb,
I have a problem after round 10 hours searching I come to you for suport.
Only the local host is working: //127.0.0.1
But I...
Last post
OK thanks MarPlo.... Wishing overseas nice weekend
- GET_id not working in UnLink (delete file)
PHP - MySQL
First post
I searching for an hour for a solution; unlink seems not to work with GET id
<?php
$id = (int) $_GET ;
echo $_GET ;
$file = fopen( '.$_GET...
Last post
Here is an answer `o god after 2 hours shame on me for this one`
<?php
$file_pointer = $_GET .'.txt';
if (!unlink($file_pointer)) {
echo (...