TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Add and Remove CSS Classes
Kannadasan G
Jun 22
2015
Code
2.5
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
Add & Remove CSS Classes
//--- ADD & REMOVE CSS CLASSES ---///
// add css class
$(
"#DivID"
).addClass(
"newclassname"
);
// remove css class
$(
"#DivID"
).removeClass(
"classname"
);
// add & remove class together
$(
"#DivID"
).removeClass(
"classname"
).addClass(
"newclassname"
);
// add & remove multiple classes
$(
"#DivID"
).removeClass(
"classname classname2"
).addClass(
"newclassname newclassname2"
);