getelementbyid issue with radio button

Posted by Nelson Silva on Stack Overflow See other posts from Stack Overflow or by Nelson Silva
Published on 2012-11-12T16:55:31Z Indexed on 2012/11/12 16:59 UTC
Read the original article Hit count: 259

Filed under:
|
|

I'm trying to make an alert with the value of the selected radio button, but I allways get the first of them, regardless the one I choose...(Acompanhado);

html:

          <form/>

          <input type="radio" class="simple_form" name="grupo_1" value="Acompanhado" id="saida"/>
          <span class="texto">Acompanhado</span>
          <input type="radio" class="simple_form" name="grupo_1" value="Individual" id="saida"/>
          <span class="texto">Individual</span>
          </form>

js:

           function save() {
       var saida_js = document.getElementById('saida').value;
       alert("Tipo de saida: " + saida_js);
           }

Any idea ?

© Stack Overflow or respective owner

Related posts about html

Related posts about radio-button