Reputation: 883
How can I change the css color properties of a button in the bootstrap framework? For example, one of my buttons...
<button type="button" id="button1" class="btn btn-primary btn-large" onclick="checkAnswer(0)">Some text</button>
Some jQuery...
$(document).ready(function(){
// Wrong answer! The selected button turns red.
$("#button1").click(function(){
$("btn-primary").css("background-color", "red");
});
});
Thanks.
Upvotes: 0
Views: 4234
Reputation: 141
If you don't want to change the stylesheet, you could use different bootstrap options by changing the class, for red:
class="btn btn-danger btn-large"
or for blue:
class="btn btn-primary btn-large"
http://getbootstrap.com/css/#buttons-options
Upvotes: 0
Reputation: 85518
If the commment not gave any sense :), here in code
<button type="button" id="button1" class="btn btn-primary btn-large" onclick="checkAnswer(0)">Some text</button>
<script type="text/javascript">
$("#button1").click(function() {
$(this).css('background-image','none')
.css('background-color','#FF0000') //red
});
</script>
Upvotes: 2