I have a feedback system in this website I’m building and users are asked to provide feedback for the service they’ve received. They have a choice to either provide an actual feedback or skip the entire thing. I have 2 radio buttons (1 for positive; the other negative)
<input type="radio" name="rating" value="1" id="green" /><label for="green">Positive</label><br />
<input type="radio" name="rating" value="0" id="red" /><label for="red">Negative</label>
Then, I have a textarea for users to provide the actual feedback.
<textarea style="width: 95%;" rows="6" name="feedback"></textarea>
I’d rather have the textarea enabled ONLY if the user clicks on an actual radio button. If not, the textarea remains disabled. How should I go about this? (I’m thinking jQuery)
Thanks, guys.
[EDIT]
Thanks for the quick input, guys. Also, if I may add, what if let’s say I’m generating the rows from data in MySQL. Which makes the names (ie. for userid 1) name=rating[1] and name=feedback[1]. How do I select them using jQuery?
http://jsfiddle.net/933DJ/
Update according to your comment:
http://jsfiddle.net/933DJ/1/