Manipulate styles with JQuery

$.("document").ready(function() { $("#someId").css("font-weight", "bold"); // Change one rule $("#someId").css({ // Change multiple rules "background" : "black", "color" : "white" }); $("#someId").css("font-size", "+=1px"); // Increase font by 1px // If this is assigned to a button, every click will increase by 1px. $("#someId").toggleClass("someClass"); // if element has someClass, someClass will be removed, otherwise it will be added // Nice shortcut to addClass() removeClass() functions if ($("someId").hasClass("someClass")) { // If element has .someClass execute this } });

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.