Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jQuery CSS Classes

//addClass()
$("button").click(function(){
  $("#div1").addClass("important blue");
});

//removeClass()
$("button").click(function(){
  $("h1, h2, p").removeClass("blue");
});

//toggleClass()
$("button").click(function(){
  $("h1, h2, p").toggleClass("blue");
});

//css()
$("p").css("background-color", "yellow");
Comment

jquery add css class

 $("div").addClass("important");

addClass() - Adds one or more classes to the selected elements
removeClass() - Removes one or more classes from the selected elements
toggleClass() - Toggles between adding/removing classes from the selected elements
css() - Sets or returns the style attribute
Comment

PREVIOUS NEXT
Code Example
Javascript :: replace string using javascript 
Javascript :: js get current function name 
Javascript :: javascript random int in range 
Javascript :: shadown reAct native 
Javascript :: react cdn 
Javascript :: roblox headshot image 
Javascript :: session check in javascript 
Javascript :: async storage get item 
Javascript :: javascript sample list 
Javascript :: jquery bind click 
Javascript :: javascript rtsp player 
Javascript :: check change event in jquery 
Javascript :: get child routes using parent in angular 
Javascript :: javascript get 24 hour time 
Javascript :: google script wait 
Javascript :: assign an element value as key in array of objects 
Javascript :: query selector has clas 
Javascript :: usestate array delete 
Javascript :: how to get the all input element id value using jquery 
Javascript :: jquery change text 
Javascript :: write bytes64 in json python 
Javascript :: mongoose custom object schema 
Javascript :: js generate random number 
Javascript :: open gz file node 
Javascript :: difference between == and === in javascript 
Javascript :: jquery toggle text on click 
Javascript :: TypeError: (0 , T.useState) is not a function 
Javascript :: conditional object spread 
Javascript :: delay statement in js 
Javascript :: unique string id js 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =