I am caching my objects in Jquery variable and using that variable to perform operations . I am not getting the correct syntax to get the value of checked radio button using this approach
Example
var genderVar=$('input:radio[name=sex]');
gets the radio button reference to my genderVar . To check whether the button is checked or not using genderVar the following approach works
genderVar.is(':checked')
Could you please let me know how to get the checked value using genderVar ? ( I know using direct approach $('input:radio[name=bar]:checked').val(); ) but want the way to get the value using cached object .I tried the below , but didn’t work …
genderVar(':checked').val();
Thanks and Regards
Kiran
you can use:
$(genderVar+’:checked’).val()