I have a dropdown list that when any of the words is selected it hides a field, works great.
But what I haven't been able to figure out is how to show the hidden field on selecting the blank in the dropdown list.
I'm using this code,
Code: Select all
$j(document).ready(function()
{
$j("#color").change(function()
{
if($j("#color :selected").text()=="Red")
{
$j("#shade").parents(".form-group").hide();
}
if($j("#color :selected").text()=="Green")
{
$j("#shade").parents(".form-group").hide();
}
(there's more colors)
});
});
Goal,
When selecting 'Color' the first line in the dropdown list is blank by default, is there a way to use this blank for 'on click' to show 'Shade' back again or do I need a word in the dropdown list to do this, like, 'Show shade list';;Red;;Green;;Blue;;Orange. I'm trying not to add a word that then gets added to table.