A Paul
A Paul

Reputation: 8251

Jquery radio button selector not working

I am using the below code to get all the checked radio buttons under a div element. But its not working. I think I am doing something wrong.

#divElement input[type="radio"]:checked

Upvotes: 0

Views: 761

Answers (2)

Utkarsh
Utkarsh

Reputation: 374

 $('#divElement input').on('change', function() {
       alert($('input[type=radio]:checked', '#divElement ').val()); 
    });

this way you can get the value of selected radio.Also your question is not clear whether it wants list of selected radios or just one?

Upvotes: 1

Sadikhasan
Sadikhasan

Reputation: 18600

.val() property will give you selected radio button value.

$('#divElement input[type="radio"]:checked').val();

Demo

Upvotes: 1

Related Questions