Rufan Abdullayev
Rufan Abdullayev

Reputation: 11

radiobutton html 5 radiobuttons html jquery

When I click the first radio button it is working but the second doesn't work.
Also, I noticed that only the first radio button value gets saved into the database.

<div class="btn-group" data-toggle="buttons">
    <label class="btn btn-default">
        <input id="gender" type="radio" name="gender"  value="male">male
    </label>
    <label class="btn btn-default">
        <input id="gender" type="radio" name="gender"  value="famale">Famale
    </label>
</div>

Upvotes: 0

Views: 40

Answers (1)

Afzaal Ahmad Zeeshan
Afzaal Ahmad Zeeshan

Reputation: 15860

First thing remove them from the label and paste them separately.

Second thing maybe you're referencing them using their ID. Which would always reference the first item in the HTML markup with that ID. You can change the ID of those, or use this as their class names.

Edit

In HTML, you can only use one ID per HTML document. Using same ID for multiple elements is illegal. For more, read: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input

Upvotes: 1

Related Questions