Topic: Radio buttons with javascript
ozcanarslan pro asked 9 years ago
Michal Szymanski staff pro premium priority answered 9 years ago
ozcanarslan pro answered 9 years ago
$("#asama1").click(function () {
$("#a1").show();
$("#a2").hide();
$("#g1").hide();
$("#g2").hide();
$asama = "I";
$asama1 = "Aşama I";
$title = $asama1;
document.getElementById("legend_title").innerHTML = $title;
return false;
});
and
<div class="ui-buttonset" id="asamalar">
<input type="radio" id="asama1" name="radios" value="I">
<label for="asama1">Aşama I</label>
<input type="radio" id="asama2" name="radios" value="II">
<label for="asama2">Aşama II</label>
<input type="radio" id="gozetim1" name="radios" value="gI">
<label for="gozetim1">Gözetim I</label>
<input type="radio" id="gozetim2" name="radios" value="gII">
<label for="gozetim2">Gözetim II</label>
</div>
ozcanarslan pro answered 9 years ago
Michal Szymanski staff pro premium priority answered 9 years ago
<button class="btn btn-primary" id="toggler">click me</button>
<br>
<br>
<fieldset class="form-group">
<input id="radio1" type="radio" name="group1" value="test1" checked>
<label for="radio1">Option 1</label>
</fieldset>
<fieldset class="form-group">
<input id="radio2" type="radio" name="group1" value="test2">
<label for="radio2">Option 2</label>
</fieldset>
<fieldset class="form-group">
<input id="radio3" type="radio" name="group1" value="test3">
<label for="radio3">Option 2</label>
</fieldset>
var $radios = $('input[type="radio"][name="group1"]')
$('#toggler').click(function () {
var $checked = $radios.filter(':checked');
var $next = $radios.eq($radios.index($checked) + 1);
if (!$next.length) {
$next = $radios.first();
}
$next.prop("checked", true);
});
Is that what you wanted to achieve?
About upgrading to MDB4:
1. Read please a release note to be aware Bootstrap 4 is not compatible with Bootstrap 3 (so MDB4 is not backward compatible with MDB3).
2. If it's ok for you write to Dawid on d.adach@mdbootstrap.com to get a 50% discount for MDB4 FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Pro
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No