I'm seaching a way to do some thing like that in jquery
var my_radio = ("input[name='my_radio']");
my_radio.change(){
    var val = (this":checked").val();
}
How can I do this? thank
I'm seaching a way to do some thing like that in jquery
var my_radio = ("input[name='my_radio']");
my_radio.change(){
    var val = (this":checked").val();
}
How can I do this? thank
 
    
    You have to edit this:
("input[name='my_radio']");
To this:
$("input[name='my_radio']");
And if you have multiple radio inputs, then you have to make this changes as well:
my_radio.each(function(){
    $(this).on('change', function(){
        if($(this).is(':checked')){
            console.log($(this).val());
        }
    });
});
Example:
var my_radio = $('input[type="radio"]');
my_radio.each(function(){
        $(this).on('change', function(){
            if($(this).is(':checked')){
                $('span').text($(this).val());
            }
        });
    });<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form>
  <input type="radio" name="1" value="1" />
  <input type="radio" name="1" value="2" />
  <input type="radio" name="1" value="3" />
  <input type="radio" name="1" value="4" />
</form>
<h1>You selected</h1>
<span></span>