I used all of the helpful answers on this site to try to build a jquery script to select radio buttons, but for some reason they don't work. Am I doing something wrong? For the sake of simplicity I've started back from square one.
I've attached the format that the php-generated form produces below. I tried multiple browsers, but was unable to get any button to select anything. Is there some complexity I'm not taking into account? The page is a .php page, and the form is generated in php.
Sorry for the basic question -- any help would be greatly appreciated. Not sure if it's relevant, but I want these buttons to work on mobile as well as various browsers.
Form Code:
<form class="form-horizontal" method="get" action="submit.php" name="form">
<div class="control-group">
<div class="row-fluid">
<div class="span2"></div>
<div class="span8">
<label class = "control-label" for="input1"> foreign policy </label>
<div class="controls">
<label class="checkbox inline"><input type="radio" name="group1" id="1_l" value="1_l"> Liberal</label>
<label class="checkbox inline"><input type="radio" name="group1" id="1_m" value="1_m"> Moderate</label>
<label class="checkbox inline"><input type="radio" name="group1" id="1_c" value="1_c"> Conservative</label>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span2"></div>
<div class="span8">
<br>
<center><button type="submit" class="btn btn-danger btn-large">Generate</button></center>
</div>
<div class="span2"></div>
</div>
</form>
Jquery Code:
$('button').click(
function() {
$('#1_l').attr('checked', true);
}
);