How to fill the radio button with javascript with data from the BD? [closed]

-1

I need that when loading the page the radio button is selected with the data of the database.

    
asked by Claudio Navarrete 04.12.2018 в 19:39
source

2 answers

0

To achieve what you need you must use the val () method

$("INPUT[name=nombre_del_radio]").val([valor_que_trae_tu_funcion]);

I hope you serve, greetings.

    
answered by 04.12.2018 / 19:59
source
0

You can use the checked attribute.

<input type="radio" name="xxx"  value="" checked /> 

o:

<input type="radio" name="xxx"  value="" checked="checked" /> 
    
answered by 04.12.2018 в 19:42