glepiza
asked on
jquery display hidden elements
Hello experts
I am trying to do the following. After you select an item under #type-shirts, the next menu option (#types-shirt)is suppose to display (it is set to none on the style sheet), but my code is just not working. Can someone please guide me?
thanks in advance.
html:
<p id="types-shirts">
<select>
<option value="">Select type shirt</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</p>
<p id="types-pants"> //this one has a style: display:none
<select>
<option value="">Select type pants</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</p>
js:
if ($('#types-shirts').val() != ''){
$("#types-pants").css("dis play","blo ck");
}
I am trying to do the following. After you select an item under #type-shirts, the next menu option (#types-shirt)is suppose to display (it is set to none on the style sheet), but my code is just not working. Can someone please guide me?
thanks in advance.
html:
<p id="types-shirts">
<select>
<option value="">Select type shirt</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</p>
<p id="types-pants"> //this one has a style: display:none
<select>
<option value="">Select type pants</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</p>
js:
if ($('#types-shirts').val() != ''){
$("#types-pants").css("dis
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
oh wow, that was quick. I am learning a lot here, I was looking at so many functions and never saw CHANGE. that is a great one.
Thanks so much.
Thanks so much.
You're welcome! Thanks for the points!
http://api.jquery.com/category/events/
http://api.jquery.com/change/
http://api.jquery.com/show/
http://api.jquery.com/hide/
http://api.jquery.com/toggle/
http://api.jquery.com/category/events/
http://api.jquery.com/change/
http://api.jquery.com/show/
http://api.jquery.com/hide/
http://api.jquery.com/toggle/
ASKER
I even understood the logic which is what I like more about this. today is a good learning day.
ASKER
thanks a lot for that, I do appreciated. Sometimes I just need someone to guide me. Thanks :)
eh eh I understand you! Have fun!
Open in new window