I am trying to enable/disable my submit button based on whether or not the confirmation checkbox is checked. The simplified version works just fine on jsfiddle but for some reason it doesn't work in my actual code. Here is the original code:
<div class="form-group">
<div class="col-md-offset-3 col-md-6">
<label>
<input type="checkbox" id="confirm">The above information is correct.
</label>
</div>
</div>
<div class="form-group" style="float:right">
<input type="submit" class="btn btn-primary" id="sbmBtn" value="Submit" disabled>
<input type="reset" class="btn btn-default" id="clrBtn" value="Clear">
</div>
I used the same method as I did in the functioning jsfiddle code (with the correct IDs of course), but it doesn't seem to work.. I even copy pasted my jsfiddle code into my editor, saved, and opened the page and it didn't work either.
Anyone have any ideas as to what the problem is?
EDIT: Also here is the javascript:
var checker = document.getElementById('confirm');
var sbm = document.getElementById('sbmBtn');
checker.onchange = function () {
if(this.checked) {
sbm.disabled = false;
}
else {
sbm.disabled = true;
}
}
EDIT 2: This is the correct link --> http://jsfiddle.net/94Dur/1/