.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!



Home >> Code Snippets >> JQuery >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Radio Button JQuery Change Event

Posted By:Sasi Prabhu       Posted Date: April 15, 2015    Points: 40    Category: JQuery    URL: http://www.dotnetspark.com  

Handle Change event for Radio Button in JQuery
 


HTML Element
<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">
</script>
</head>

<body>
<form>
<input id="rYes" type="radio" name="choice" checked /> Yes
<input id="rNo" type="radio" name="choice" /> No

<label id="lblresult"></label>
</form>
</body>

</html>

jQuery Script

<script>
$(function(){
$('input[name=choice]:radio').change(function(){
$('#lblresult').text($(this).attr('id'));
});
});
</script>


Happy Coding...

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend