Search code examples
jqueryhtmldomradiobuttonlist

Need help to get check the value of radio button list checked using jquery


http://jsfiddle.net/EwKNW/2/

I need to check whether the following radio buttonlist is checked yes or no.

I have tried with easier HTML structure its working fine ( http://jsfiddle.net/pfZUt/6/ )

I have trouble in using jquery and propagating through the HTML tree structure.

Any help will be greatly appreciated. Thanks in advance.


Solution

  • I don't understand your if else statements but you can get checked element names like this ,

     $('#myform').submit(function() {
            $('input:radio:checked').each(function(){
              alert( $(this).attr('name'));
            });
         });​
    

    http://jsfiddle.net/pfZUt/7/

    You need to remove this from second selector because it's pointing to the element_475 which tries to select inside it.