Skip to content
Advertisement

How to Change HTML Tags to Another Tag with JQuery?

I have a header with <h5>Header</h5> tag and I want to change it to <i class="material-icons>flash_on</i> when I hover it and change it back on hover out

Here is my html code;

JavaScript

Advertisement

Answer

You don’t need JavaScript, you can add simple CSS for change display of the elements e.g.

JavaScript
JavaScript

Or if you need change HTML content, so you can change with jQuery like this:

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement