I have a web page on which there are several buttons and i want to change it’s color when it is selected. There is an example of jQuery, please take a look. I want to do the same but i bit confused.
my HTML page is as :
CSS : .blackButton {
background: url("Black_button.jpg");
vertical-align: middle;
margin-top: 1%;
margin-bottom: 1%;
}
<div id="id1">
<input type="button" class="blackButton"/>
</div>
<div id="id2">
<input type="button" class="blackButton"/>
</div>
<div id="id3">
<input type="button" class="blackButton"/>
</div>
js : I just tried, but not working
$(function() {
$(".blackButton").selectable();
});
Add this javascript, and a css rule for .selected and you should get the desired result.
Created a jsfiddle.