I've created a set of radio buttons using bootstrap and now I need to do a check to determine which button is active (To determine what string to use later in my project).
Currently I'm just trying to get an alert to appear for debugging:
$(document).ready(function() {
var rg_eu = document.getElementById('option1');
$('#searchplayer1').keypress(function(e) {
var keycode = (e.keyCode ? e.keyCode : e.which);
if(keycode == '13') {
if($(document.getElementById('option1')).hasClass('active')) {
alert(rg_eu);
}
}
});
});
However my alert doesn't appear. Also tried checking with 'focus' and 'btn btn-secondary active' - but nothing seemed to work. Do I have to do this in some unconventional manner because it's done through bootstrap?