codingtcher.com
Theme Night
Home
Login

Jquery add class

//onscroll add class jquery
$(window).scroll(function() {    
    var scroll = $(window).scrollTop();
    if (scroll >= 500) {
        $(".clearHeader").addClass("darkHeader");
    }
});
//add class jquery
$( "p" ).addClass( "myClass yourClass" );

//jquery remove and add class
$( "#foo" ).removeClass( 'className');

$( "#foo" ).addClass( 'className');
//add data after last child in jquery
$('#list div:last').after('<div></div>');

Related Code