Mac Ben Mac Ben - 1 year ago 96
Javascript Question

get bootstrap radio value from href buttons

Have a problem when trying to get values of radio with jquery.

Here my radio buttons:

<div class="input-group">
<div id="radioBtn" class="btn-group">
<a class="btn btn-warning radio-selector btn-sm active" data-toggle="happy" data-title="pub">Pub</a>
<a class="btn btn-warning radio-selector btn-sm notActive" data-toggle="happy" data-title="pri">Pri</a></a>
<input type="hidden" name="happy" id="happy">
<a id="add" class="btn btn-lg btn-primary">Add</a>

And here the javascript code to get the selected value:

$('#add').live("click",function() {
var getdata = $('#radioBtn .radio-selector:checked').data("title");

But all time i get undefined value ! any solution to get the
in the radio buttons ?

Answer Source

try this

    var getdata = $('#radioBtn >').data("title");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download