I have a test form where my radio button have text and value.
I’m trying to pass text from label from checked radio button to hidden field name=form[test]
this is my function:
var levels = $('input[name="form[Button]"]:checked + label').map(function() {
return $(this).text();
}).get();
$('input[name="form[test]"]').change( function() {
($(this).val(levels));
});
HTML
<input type="radio" id="Button0" value="0" name="form[Button]">
<label for="Button0">This item is worth £0</label>
<input type="radio" id="Button1" value="100" name="form[Button]">
<label for="Button0">This item is worth £100</label>
<input type="hidden" value="" id="test" name="form[test]">
But my change in jQuery simply dont work.
Many Thanks for your help in advance!
Dom
And you can see a live demo.