javascript - How can i change icon color on dblclick() -
i'm trying change font awesome icon color using jquery dblclick(). want change color when user double clicks on icon gives me error
html
<body> <div class ="contain"> <div id ="pic"> <img src ="https://www.w3schools.com/css/img_fjords.jpg"/> </div> <div id="desc"> <div id="img-row"> <i class="fa fa-heart-o" aria-hidden="true"></i> </div> <p><!---- text ---></p> </div> </div> </body>
javascript
$(document).ready(function(event){ $('.fa fa-heart-o').dblclick(css("color", "red")); });
any highly appreciated.
you need provide handler function dblclick event. inside handler function can use this
change color of clicked element. this:
$(document).ready(function(event){ $('.fa fa-heart-o').dblclick(function(){ $(this).css("color", "red"); }); });
Comments
Post a Comment