0

i need to change background-color of a particular colum when the table header corresponding to that column is clicked.How to achieve this using html css & jQuery.

2
Contributors
4
Replies
9
Views
4 Years
Discussion Span
Last Post by imBaCodes
2
$(document).ready(function(){

    $('#BUTTON_ID').Click(function{

        $('#the_element_ID').css('background-color','#put_your_color_here');
        $(this).parent().css('background-color',$(this).attr('data-value'));

    });


});

that should do it.

2

The "BUTTON_ID" that is the Id of the tag that will trigger the background change
example <input type= "button" id = "BUTTON_ID" /> the "the_element_ID" will be your Table header ID and the data-value is a default.

2
$(document).ready(function(){
    $('#BUTTON_ID').Click(function{
        $('#the_element_ID').css('background-color','#put_your_color_here');
    });
});

For you not to worry about the other code. try it like this it will still work.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.