Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67411

How to print my radio buttons in textarea? [duplicate]

$
0
0

This question already has an answer here:

I have questionnaire with four radio buttons and one input type text. Print in sequence without deleting the previous one.

var todos = $('input[type="radio"]');
  $(todos).on('click',() =>{
    var newText = '';
    Array.from(todos).forEach(
      function(element) {
        if(element.checked)
          newText+=element.value
      });
    $('#notem').val(newText);
  });

Here is my html code

FUTBOL
<br>
SI<input type="radio" name="futbol" id="r1" value='SI PRATICARIA FUTBOL, '>
NO<input type="radio" name="futbol" id="r2" value='NO PRACTICARIA FUTBOL, '>
<br><br>
NATACION
<br>
SI<input type="radio" name="natacion" id="r3" value='SI PRATICARIA NATACION, '>
NO<input type="radio" name="natacion" id="r4" value='NO PRATICARIA NATACION, '>
<br><br>
CICLISMO
<br>
SI<input type="radio" name="ciclismo" id="r5" value='SI PRACTICARIA CICLISMO, '>
NO<input type="radio" name="ciclismo" id="r6" value='NO PRACTICARIA CICLISMO, '>
<br><br>
LE GUSTARIA PRATICAR OTRO DEPORTE
<br>
SI<input type="radio" name="otrod" id="r7" value='SI PRACTICARIA OTRO'>
NO<input type="radio" name="otrod" id="r8" value='NO PRACTICARIA OTRO'>
<br>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

Viewing all articles
Browse latest Browse all 67411

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>