+ 5
Oh so you want to switch it on each click. You could've explained it in the post's Description though, so we can go straight up to fixing the actual problem ...
The class "fa fa-thumbs-o-up" and "fa fa-thumbs-up" are combination of classes separated by space. That's why we get an error when we try to toggle by those classes. Class toggling apparently only supports single class name, so ... skip the "fa " and only toggle either "fa-thumbs-o-up" or "fa-thumbs-up"
thumbsUp.classList.toggle( "fa-thumbs-up" );
+ 2
Hope this helps you
https://code.sololearn.com/WwGRcabta1zJ
+ 2
That's a good question YourMom, let's hear what others' has to say, we can both learn something 👍
+ 1
It might help if you log <Bell>'s class name after toggling the two classes, to see why two class' toggle was there.
function bell(Bell)
{
Bell.classList.toggle( "fa-bell-o" );
Bell.classList.toggle( "fa-bell" );
console.log( Bell.className );
}
+ 1
Ipang okey, thanks : (
+ 1
Good
0
What was supposed to happen when the <i> was clicked?
0
Then don't use toggle(), directly set the class name instead ...
thumbsUp.className = "fa fa-thumbs-up";
0
From recent search I found that, FA 5 has extended the class "fa" to "far", "fas", "fab" etc depending on which CSS stylesheet was used.
Since you use FA 4, "far" class is not available yet, and you should rather use plain "fa"
<i onclick="bell(this)" class='fa fa-bell'></i>
+ Where I read about it ...
https://stackoverflow.com/questions/24922833/fontawesome-icons-are-not-showing-why
0
I didn't get what you mean ...
"color is transparent and when you click it color is transparent" 🙄
0
Aah now I get it, so it seems the "-o" has the same effect, but I don't know *for sure* whether this will work for all FA icons.
+ So in HTML
<i onclick="bell(this)" class='fa fa-bell-o'></i>
+ In JS
function bell(Bell)
{
Bell.classList.toggle( "fa-bell-o" );
Bell.classList.toggle( "fa-bell" );
}
0
Because "fa-bell" and "fa-bell-o" refer to different class.
The two lines toggle different classes, don't you see?
0
I have to go now, catch you later ...
0
Can you tell me what actually you want to do please, i might can help you
0
We can only toggle a single class at a time, so first we toggle "fa-bell-o" and then we toggle "fa-bell". We can't toggle both.
Why is it exactly that way, Idk LMAO
0
What's the problem with your button, they are working properly?
0
it's ok bro/sis : )
0
Malay Patra,
Idk either, but a question related to Python is frequent, sometimes including framework related stuffs.
I think you can publish a feeds post on that question about flask developer. I doubt asking whether anyone here work with flask in Q&A Discussion will get a respond as you expect, due to the scoping of topics per the guideline.
https://www.sololearn.com/Discuss/1316935/?ref=app
- 3
thumbsUp.classList.toggle( "fa-thumbs-up" );