JS | Adding class

var el = document.getElementById('some_id'); if(el) { el.className += el.className ? 'new_class' : 'new_classs'; } //or jquery $( "element" ).addClass( "newClass" );

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.