0
I have a legacy system in php that generates the input radios, and the names of these fields are dynamic, such as the $Row object. And now I need to take the values of the radio fields and their respective names so that they are saved in the bank through a requisicao ajax. Take the example:
<?php
$row = new stdClass();
$row->sigla = array('ag', 'bg', 'cg');
foreach ($row->sigla as $r) {
echo "<tr>
<td style='text-align:center'><input type='radio' value='1' name='$r' class='avaliacao'>SIM</td>
<td style='text-align:center'><input type='radio' value='2' name='$r' class='avaliacao'>NAO</td>
<td style='text-align:center'><input type='radio' value='3' name='$r' class='avaliacao'>N/A</td>
</tr><br/>";
}
?>
And the js I’m trying to run, but not knowing how to get the name of the field:
$(document).ready(function(){
$("input[type='radio']").click(function() {
var value = $(this).val();//aqui retorna o valor correto
//AQUI gostaria de pegar o valor do que foi clicado, mas como pegar o nome do campo?
});
});
easy so kkkkkk
– tkmtts
Didn’t work out ?
– Leandro Lima
gave yes, very easy, I need to study more js. Thank you
– tkmtts