How to highlight clicked div?

var highlight = 'v_highlight';
var $cols = $('#vTable1 tr:not(:eq(0))').click(function() {
$cols.removeClass(highlight);
$(this).addClass(highlight);
$('#v_LegalMoreView').fadeIn();
smoothScroll(document.getElementById('v_LegalMoreView'));
});





2nd Example==> 

HTML-->

    <div class="divs">
        Thumb1
    </div>    
    <div class="divs">
        Thumb1
    </div>    
    <div class="divs">
        Thumb1
    </div>    
    <div class="divs">
        Thumb1
    </div>    
        

CSS-->

.color {
    background-color: yellow;

}

JS-->

var Acolor = 'color';
var $cols = $('.divs').click(function(e) {
    $cols.removeClass(Acolor);
    $(this).addClass(Acolor);

});

Comments

Popular posts from this blog

datatable with both top and bottom scroll bar.

Display Loader and disable page while waiting for ajax request

Remove GIT integration from VSCode