Hello
In my application i need a radio group, in which whenever a button is checked, an alert occur so that i can post its value to ajax post in jquery.
Can you help me please how i can do it in jquery?
Hello
In my application i need a radio group, in which whenever a button is checked, an alert occur so that i can post its value to ajax post in jquery.
Can you help me please how i can do it in jquery?
Try something like this:
$(function(){
$('input[type="radio"]').click(function(){
if ($(this).is(':checked'))
{
alert($(this).val());
}
});
});
If you give your radio buttons a class then you can replace the code $('input[type="radio"]')
with $('.someclass')
.
$('#radioId').click(function() {
if ($(this).is(':checked')) {
// put your code here and your alert
}
}
$("input[type=radio]").change(function(){
alert( $("input[type=radio][name="+ this.name + "]").val() );
});