// Add Class
$('.element').addClass('this-is-a-new-class'); // jQuery
document.querySelector('.element').classList.add('this-is-a-new-class'); // Vanilla JS
// Remove Class
$('.element').removeClass('this-is-a-new-class'); // jQuery
document.querySelector('.element').classList.remove('this-is-a-new-class'); // Vanilla JS
// Toggle Class
$('.element').toggleClass('this-is-a-new-class'); // jQuery
document.querySelector('.element').classList.toggle('this-is-a-new-class'); // Vanilla JS
// Select All Elements With Query
var elems = $('.element');
var elems = document.querySelectorAll('.element');
// Hide
$('.element').hide();
document.querySelector('.element').style.display = 'none';
// Even more that I don't know off the top of my head :)
Odds are you don't really need jQuery, it adds un-needed bloat to your site.
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.