Reputation: 11
Category is the first item yo will see i want it to be removed or disabled after is is selected so that it doesn't show when viewing the other drop down menu items.
<select NAME="category" style="width:130px; background-color:#FFF; font-weight:bold; font-size:12px;" ONCHANGE="setup(document.search1.category.value)">
<option value="category" selected="selected">Category</option>
<option value="cleaning">Cleaning</option>
<option value="cooling">Cooling</option>
<option value="heating">Heating</option>
<option value="kitchen">Kicthen</option>
<option value="lighting">Lighting</option>
<option value="washroom">Washroom</option>
</select>
Upvotes: 0
Views: 1771
Reputation: 547
If you want to remove the "category" line item after a user selects a different item from your drop down, you would do this:
<script type="text/javascript">
$(document).ready(function () {
$('#selectList').change(function () {
if (this[0].value == "category")
{
this.remove(this[0]);
}
});
});
</script>
<select id='selectList' name="category"
style="width:130px; background-color:#FFF; font-weight:bold; font-size:12px;">
<option value="category">Category</option>
<option value="cleaning">Cleaning</option>
<option value="cooling">Cooling</option>
<option value="heating">Heating</option>
<option value="kitchen">Kicthen</option>
<option value="lighting">Lighting</option>
<option value="washroom">Washroom</option>
</select>
That will remove the Category row from the drop down and ONLY the category row.
Upvotes: 0
Reputation: 4198
This will remove the slected Item
<select NAME="category" style="width:130px; background-color:#FFF; font-weight:bold; font-size:12px;" onchange="this.remove(this.selectedIndex);">
<option value="category" selected="selected">Category</option>
<option value="cleaning">Cleaning</option>
<option value="cooling">Cooling</option>
<option value="heating">Heating</option>
<option value="kitchen">Kicthen</option>
<option value="lighting">Lighting</option>
<option value="washroom">Washroom</option>
</select>
Upvotes: 1
Reputation:
You should use it like this disabled = 'disabled'
<select NAME="category" style="width:130px; background-color:#FFF; font-weight:bold; font-size:12px;" onchange="javascript:this.disabled = 'disabled';">
<option value="category" selected="selected">Category</option>
<option value="cleaning">Cleaning</option>
<option value="cooling">Cooling</option>
<option value="heating">Heating</option>
<option value="kitchen">Kicthen</option>
<option value="lighting">Lighting</option>
<option value="washroom">Washroom</option>
</select>
Upvotes: 0