Hope this can help you. If you have any question and confusion about the problem. Please don't hesitate to let me know.
Best regards
Cathy
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
483 Points
2238 Posts
Change background color of a text field when radio button clicked to yes
Sep 23, 2016 02:51 PM|StrangerMike|LINK
Can anyone help me with some script that when a radiobutton (No/Yes) is clicked to 'yes' the background of a text field is turned purple?
(And if clicked back to 'No', the textbox background goes back to white)?
Thank you!
Star
8670 Points
2882 Posts
Re: Change background color of a text field when radio button clicked to yes
Sep 23, 2016 05:01 PM|Cathy Zou|LINK
Hi strangermike, From your description, I suggest you could use jquery. I make an example according to your code, you could refer to it.
Hope this can help you. If you have any question and confusion about the problem. Please don't hesitate to let me know.
Best regards
Cathy
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Contributor
6874 Points
1980 Posts
Re: Change background color of a text field when radio button clicked to yes
Sep 24, 2016 01:04 AM|RichardY|LINK
Cathy Zou provides a good solution except that I would recommend using the jQuery .on() method instead of .live().
Per the jQuery docs as of jQuery 1.7, the .live() method is deprecated.
http://api.jquery.com/live/