This is a solution sharing post, from a newbie that always have a problem to do small little things but often being helped by other kindhearted power users in here especially, The Legendary Mr Pavel-ww
Oftentimes, we need to change something in our template or just the web entirely, and installing some commercial plugin might be the last option we had for some reason OR you're just too lazy to tinkering with the template codebase to find the little line to be amended like me..

NO PLUGIN NEEDED HERE
So, for the past few days, I need to change the top bar menu icon and kinda bogged down, and even too "small" to ask in here

I need to change the mobile phone icon to the new fax machine icon, or you basically can just change ANY ELEMENTS in ANYWHERE actually as long it have the HTML snippet line
For example, in the template html, it will using this line
Code: Select all
<span class="fas fa-mobile-alt" aria-hidden="true"></span>
Code: Select all
<span class="fas fa-fax" aria-hidden="true"></span>
I just put 2 lines of JS actually in the template custom JS/CSS column, every modern template should have this, like the Joomshaper Helix, which is my go-to for all my project, and their page builder is just getting more powerful nowadays
Code: Select all
$(document).ready(function(){
// When the page loads, change the icon class
$('.fas.fa-mobile-alt').removeClass('fa-mobile-alt').addClass('fa-fax');
});

so for the final result, you will get this beautiful fontawesome css based icon, without the need to modify their codebase, everything is done automatically on the fly via the JQUERY

--------------------
Technical Explanation:
jQuery: The script waits for the document to be fully loaded ($(document).ready()), then selects the <span> element with both the fas and fa-mobile-alt classes.
Class Change: Using removeClass('fa-mobile-alt'), it removes the old icon class and then adds addClass('fa-fax') to replace it with the new icon.
Font Awesome: It links to Font Awesome icons, so you can use the icons as you did with fa-mobile-alt and fa-fax.
Why jQuery and not CSS?
CSS on its own doesn’t have a mechanism for dynamically changing the class of an element based on the load event.
jQuery is excellent for DOM manipulation, making it easy to change class names and, in turn, swap icons or other elements.
--------------------
P/S I will share later the same trick on how to get the CSS based icons for the web utilities icons above, so no more jpeg/png files in html table needed anymore.. quick and simple solution for everyone!
Triva: The word sounded "Joomla" in my native language also means "Let's come together".. and I'm not even African, but the sacred sharing spirit keeps us all together in this forum
