how can I send data from a class radio input to laravel without touching the names

0

I would like to send parameters by means of a class in the radio type inputs to the laravel driver without touching the property name

<div class="form-group col-lg-6 col-xs-12">
    <label class="control-label">Sexo:</label>
    <label for="radio-1">Masculino</label>
    <input type="radio" name="masculino" id="radio-1value="1">
    <label for="radio-2">Femenino</label>
    <input type="radio" name="femenino" id="radio-2"value="1">
</div>
    
asked by Juan Esteban Yarce 17.01.2018 в 16:35
source

1 answer

0

According to what I have done, I understand that the radio input must have the same class, of course if you only want to select one, let's suppose in my edition the class is "sexes".

<div class="form-group col-lg-6 col-xs-12">
<label class="control-label">Sexo:</label>
<label for="radio-1">Masculino</label>
<input type="radio" name="sexos" id="masculino"value="1">//te faltaba una comilla doble al id
<label for="radio-2">Femenino</label>
<input type="radio" name="sexos" id="femenino"value="2">

You can create a variable or those that you need, to take the value of the attributes you need to use.

   $(".sexos").click(function () {
            var valorid = $(this).attr("id");
            var valor = $(this).attr("value");
    });

I hope it serves you. Greetings.

    
answered by 17.01.2018 в 17:35