How to remove a particular class using JQuery? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to remove a particular class using JQuery?

In jQuery you can remove all the class or id’s or even Element using .hide(), But if I’m having, 5 Paragraph Element, where all of them has the same class name “abcde” How to particularly remove the content of class “abcde” inside the 3rd or 4th paragraph? Hope someone answers! 🙏

10th Jul 2018, 12:02 PM
Raaja Thalapathy
Raaja Thalapathy - avatar
7 Answers
10th Jul 2018, 1:15 PM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 1
Raaja Thalapathy. B the argument that you pass to .removeClass() is the name of the class that you want to remove. So, for example $('div').removeClass('namehere'); This removes the class 'namehere' from all divs.
10th Jul 2018, 1:03 PM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 1
Oh Thanks Jonathan Pizarra ! I get it But how do u particularly pick a particular element’s class (like i asked in the question above) 3rd or 4th Paragraph and remove only that particular paragraph’s content?
10th Jul 2018, 1:07 PM
Raaja Thalapathy
Raaja Thalapathy - avatar
+ 1
Wow! 😇 Thanks a lot Jonathan Pizarra for taking time to show me as code! Really appreciate, No wonder why they gave you Moderator Status 😉 Thanks again man 🙏🙌🏻
10th Jul 2018, 1:19 PM
Raaja Thalapathy
Raaja Thalapathy - avatar
+ 1
You are welcome Raaja Thalapathy. B 👍
10th Jul 2018, 1:20 PM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
0
$('.class').removeClass('class_to_remove');
10th Jul 2018, 12:35 PM
Yuri Biasi
Yuri Biasi - avatar
0
Yuri Biasi Correct me if im wrong, I use, $(‘.class’) is the Class name we are reffering to jQuery, .removeClass(‘3’) means the 3rd Element which has ‘class’ as its name? Am i wrong?
10th Jul 2018, 12:42 PM
Raaja Thalapathy
Raaja Thalapathy - avatar