I have a form with dynamically created form elements.
I need to get the value of each element, and send an ajax request to make sure the data is ok (the easy part). I can get each elements value easy enough, but the problem comes in with radio buttons. For example:
<input type = 'radio' class = 'form_element' value = '1'>
<input type = 'radio' class = 'form_element' value = '1'>
<input type = 'radio' class = 'form_element' value = '1'>
if i do something like...
$('.form_element').each(function(){
alert($(this).val());
});
it will print the values of all of the radio buttons, regardless if it is checked or not.
I need it to only return the value of the one that is checked.
So, is there a way to return the type of an input element from jquery?