Change Class to a another Class in the CSS part! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Change Class to a another Class in the CSS part!

In my code https://code.sololearn.com/WBm9TKxKsx7L/#html I've a big interactivity problem! I don't want do an animation with JS and I use class in CSS to do the thing! The problem is the execution when I use a OnClick...HOW CHANGE THE CLASS WITH A ONCLICK ?! I tried "OnClick="this.class:'SautVertical'" after defined my default class at "Neutre" but...it's not very effective! I tried to use id and <imput> but it's no help! I tried to use JQuery... (just a copy-past of this code: https://stackoverflow.com/questions/7014385/javascript-jquery-to-change-class-onclick ) So: $('.showhide').click(function() { $(this).removeClass('myclass'); $(this).addClass('showhidenew'); }); ...and I lost my power of understandability... SEND HELP!!

1st Dec 2018, 1:50 AM
Glin Kagé Kidpaddleetcie
Glin Kagé Kidpaddleetcie - avatar
3 Answers
+ 3
:active
1st Dec 2018, 6:04 AM
Gordon
Gordon - avatar
+ 1
onclick=" this.class='Neutre' " like this ?
1st Dec 2018, 3:57 AM
Taste
Taste - avatar