Organizational Research By

Surprising Reserch Topic

Jquery If radio button is checked


I have these 2 radio buttons at the moment so that the user can decide whether they need postage included in the price or not:

 type="radio" id="postageyes" name="postage" value="Yes" /> Yes
 type="radio" id="postageno" name="postage" value="No" /> No

I need to use Jquery to check if the 'yes' radio button is checked, and if it is, do an append function. Could someone tell me how I'd do this please?

Thanks for any help

edit:

I've updated my code to this, but it's not working. Am I doing something wrong?

 type='text/javascript'>
// 
jQuery(document).ready(function(){

$('input:radio[name="postage"]').change(function(){
    if($(this).val() == 'Yes'){
       alert("test");
    }
});

});

// ]]>

asked May 8, 2015 in JAVASCRIPT by rajesh
0 votes
14 views



Related Hot Questions

3 Answers

0 votes
NULL
answered May 8, 2015 by rajesh
0 votes
NULL
answered May 8, 2015 by rajesh
0 votes
NULL
answered May 8, 2015 by rajesh

...