change the style of selected div/element

this fiddle will show you an short example , how you can change the style of a selected div/element .

by sheelpriy gautam

HTML

<div class="tab bat">select1</div>
<div class="tab bat">select2</div>
<div class="tab bat">select3</div>

CSS

div.active {
    background-color: #2e2e2e !important;    
    color:white;
    height:25px;
    width:100px;
    float:left;
    margin-right:2px;
    text-align:center;
    padding-top:5px;
}

div.bat:hover {
    background-color: #80a3bb;  
    height:25px;
    width:100px;
    float:left;
    margin-right:2px;
    text-align:center;
    padding-top:5px;
}
div.bat{
    background-color: orange;
    height:25px;
    width:100px;
    float:left;
    margin-right:2px;
    text-align:center;
    padding-top:5px;
}

JavaScript

$('.tab').click(function() {
    $(this).addClass('active').siblings().removeClass('active');
});
//$('.tab').hover(function() {
  // alert("ok");
//})