CopyPastor

Detecting plagiarism made easy.

Score: 1; Reported for: Exact paragraph match Open both answers

Possible Plagiarism

Plagiarized on 2018-08-31
by M3ghana

Original Post

Original - Posted on 2009-02-27
by Peter J



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Please check this link -
https://stackoverflow.com/questions/596351/how-can-i-know-which-radio-button-is-selected-via-jquery
$('#myForm input').on('change', function() { alert($('input[name=radioName]:checked', '#myForm').val()); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <form id="myForm"> <input type="radio" name="radioName" value="1" /> 1 <br /> <input type="radio" name="radioName" value="2" /> 2 <br /> <input type="radio" name="radioName" value="3" /> 3 <br /> </form>
To get the value of the selected radioName item of a form with id myForm:
$('input[name=radioName]:checked', '#myForm').val()
To get the value of the **selected** `radioName` item of a form with id `myForm`:
$('input[name=radioName]:checked', '#myForm').val()

Here's an example:
<!-- begin snippet: js hide: false -->
<!-- language: lang-js -->
$('#myForm input').on('change', function() { alert($('input[name=radioName]:checked', '#myForm').val()); });
<!-- language: lang-html -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <form id="myForm"> <input type="radio" name="radioName" value="1" /> 1 <br /> <input type="radio" name="radioName" value="2" /> 2 <br /> <input type="radio" name="radioName" value="3" /> 3 <br /> </form>
<!-- end snippet -->


        
Present in both answers; Present only in the new answer; Present only in the old answer;