There is such a layout

<div class="radio_buttons"> <div> <input type="radio" name="type_of_cleaning" id="radio1" checked /> <label for="radio1">Daily</label> </div> <div> <input type="radio" name="type_of_cleaning" id="radio4" /> <label for="radio4">Weekly</label> </div> <div> <input type="radio" name="type_of_cleaning" id="radio2" /> <label for="radio2">Twice a week</label> </div> <div> <input type="radio" name="type_of_cleaning" id="radio3" /> <label for="radio3">Three times a week</label> </div> </div> 

4 radio buttons. When I get a value, I get [type_of_cleaning] => on and how to get the value Daily, Weekly, Twice a week

    1 answer 1

    Add value for input:

     $("input[type='radio']").change(function() { alert($(this).val()); }); 
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <div class="radio_buttons"> <div> <input type="radio" name="type_of_cleaning" id="radio1" checked value="daily" /> <label for="radio1">Daily</label> </div> <div> <input type="radio" name="type_of_cleaning" id="radio4" value="weekly" /> <label for="radio4">Weekly</label> </div> <div> <input type="radio" name="type_of_cleaning" id="radio2" value="twice a week" /> <label for="radio2">Twice a week</label> </div> <div> <input type="radio" name="type_of_cleaning" id="radio3" value="hree times a week" /> <label for="radio3">Three times a week</label> </div> </div>