mardi 19 juillet 2016

JQuery form of radio input

I am trying to make a simple form of radio inputs where at most 1 can be selected:

<form id='forma' action='predmeti.php' method='GET'>
        1:<input type='radio' name='godina' value='1'/>
        2:<input type='radio' name='godina' value='2'/>
        3:<input type='radio' name='godina' value='3'/>
        <input type='button' id='ok' value='Izaberi godinu!'>
</form>

How do i allow form submit only if one is selected and prevent submit if nothing selected? The form is submited by clicking on the id='ok' button.

Aucun commentaire:

Enregistrer un commentaire