[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Applying and changing the classname of selected radio with scripting

Posted on 2011-10-07
1
Medium Priority
?
292 Views
Last Modified: 2012-08-13
Hello,

I have a form that has a radio button set.  When the page loads, I want use some simple scripting that immediately apply a classname to the label of the corresponding input and when the user click on another radio button in the set to remove that class and apply the classname to the newly selected radio button label.

Any ideas how this can be done?

JSFiddle: http://jsfiddle.net/eYDV4/

Thanks
-JaXL

 
<form id="myForm" action="" method="post">
   <input type="radio" id="radio1" name="myRadio" value="radio1">
   <label for="radio1">radio1</label>
   <input type="radio" id="radio2" name="myRadio" value="radio2">
   <label for="radio2">radio2</label>
   <input type="radio" id="radio3" name="myRadio" value="radio3" checked="checked">
   <label for="radio3">radio3</label>
   <input type="radio" id="radio4" name="myRadio" value="radio4">
   <label for="radio4">radio4</label>
</form>

Open in new window

0
Comment
Question by:JaXL
1 Comment
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 1000 total points
ID: 36930055
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses
Course of the Month17 days, 22 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question