D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
aaizemberg
Full window
Github gist
Accediendo a los valores de un radio button desde d3js
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Accediendo a los valores de un radio button</title> <script src="https://d3js.org/d3.v5.min.js"></script> </head> <body> <div> <label for="male">Male</label> <input checked type="radio" name="gender" id="male" value="male"><br> <label for="female">Female</label> <input type="radio" name="gender" id="female" value="female"><br> <label for="other">Other</label> <input type="radio" name="gender" id="other" value="other"><br><br> </div> <script> // si queres saber, cual es el valor seleccionado, podes usar esto: console.log( d3.select('input[name="gender"]:checked').property("value") ); d3.selectAll('input[type="radio"]').on("change",function(d){ console.log( this.value ); }) </script> </body> </html>
https://d3js.org/d3.v5.min.js