For some reason when I use jQuery .css() it won’t change my CSS. I've checked it through several times, and the syntax seems to be right.
I can see that it is running the operation, so the only thing that does not work is the CSS line:
jQuery:
var document = this;
jQuery(document).ready(function($){
console.log("document ready");
jQuery("#buttonrow .button").click(function(){
var $this = $(this);
console.log("button clicked");
if($this.attr("id") == 'redbutton'){
console.log("red");
$('#redCheckDiv').css('display', 'block');
} else {
console.log("blue");
$('#blueCheckDiv').css('display', 'block');
}
});
});
HTML
<div class="row" id="buttonrow">
<div class="col-md-5 col-md-offset-1 button" id="bluebutton">
<div class="blueCheckDiv"></div>
<div class="col-md-10 col-md-offset-1 text-center" id="text-container">
<p>This is the blue box</p>
</div>
</div>
<div class="col-md-5 button" id="redbutton">
<div class="redCheckDiv"></div>
<div class="col-md-10 col-md-offset-1 text-center" id="text-container">
<p>this is the red box</p>
</div>
</div>
</div>