Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
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! š
7 Respostas
+ 1
You can use .eq() Raaja Thalapathy. B
Here's a working code
https://code.sololearn.com/W5aJdG4norYy/?ref=app
+ 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.
+ 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?
+ 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 ššš»
+ 1
You are welcome Raaja Thalapathy. B š
0
$('.class').removeClass('class_to_remove');
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?