Pavan K Pavan K - 2 months ago 7x
Javascript Question

change icon on click with materializecss

I am using the floating action button for displaying a menu and have a save icon in the menu

<div id="menu" class="fixed-action-btn horizontal click-to-toggle" style="bottom: 85px; right: 18px;">
<a class="btn-floating btn-large red">
<i class="material-icons">menu</i>
<li ><a href="#" class="btn-floating blue"><i id="save" class="material-icons">add</i></a></li>

I would like to change the icon to
on click of the add button , if possible with an animation. How can I do this ? I am noob could someone point me in the right direction.


Do this in your onclick handler function, use id selector preferably, i just used class here,

$(".blue").html('<i id="save" class="material-icons">check</i>');