I have a search button, in which I want to change the icon as well as the color of the border at the same time when it is being clicked on:
$(function () {
$("#search").click(function () {
$("#search").css({ "border": "2px", "border-style": "ridge", "border-color": "#000000" })
});
$("#search").click(function () {
$("#search").replaceWith($('<img>', { src: 'Icons/magnifier.png' }))
});
});
Right now, my two functions work individually, but when I combine the two, like in my example, only the last one fires.
Is there a way in which I can combine the two functions, so that both the border and the image changes when I click on it?
CSS for the box:
.topnav img {
border: 2px ridge #7ab5dc;
position: relative;
height: 20px;
width: 20px;
float: right;
margin-top:15px;
margin-right:20px;
padding:3px;
border-radius: 5px;
}
HTML
<div class="topnav">
<img id="search" class="search" src="Icons/magnifier2.png" />
</div>