jQuery animations in forms
let me start with my form:
http://jsfiddle.net/UC开发者_Go百科JpF/
I want to display only one line from the three below selectable options, based on selected stuff. How to do that?
Thanks.
Here's a modified version of your fiddle that should do what you want: http://jsfiddle.net/JZNMy/
The key points are that I reference the row showing the message to the selected option using the value on the option plus '-message' as the id of the message row. Then, I bound to the .change
event of the select box, which gets the currently selected value, hides all of the messages, then shows the related one.
EDIT: I updated the fiddle link with one that automatically triggers the change
event on the select box to make sure one of the messages is displayed.
精彩评论