I have a tab with an image inside of it and I want to make it so when you hover/select the tab the image changes to a different image and then when you unselect/ unhover it changes back to the original image.
When you hover/select on the tab I want to get the image changes from Icon20.png to Icon10.png
Here is the code for the tab
$('#one').hover(function(){
$('#two').css({'content': 'url(https://sep.yimg.com/ty/cdn/vacuumshopper/Icon10.png)'})},
function(){
$('#two').css({'content': 'url(https://sep.yimg.com/ty/cdn/vacuumshopper/Icon20.png)'})
});
$('#one').click(function(){
$('#two').css({'content': 'url(https://sep.yimg.com/ty/cdn/vacuumshopper/Icon10.png)'})},
function(){
$('#two').css({'content': 'url(https://sep.yimg.com/ty/cdn/vacuumshopper/Icon20.png)'})
});
div.tab {
overflow: hidden;
border: 1px solid #336699;
background-color: #336699;
font-family: "Lato", "Sans-Serif";
}
div.tab button {
background-color: #336699;
float: left;
border: #FFF;
outline: none;
cursor: pointer;
padding: 14px 16px;
transition: 0.3s;
color: #fff;
font-family: "Lato", "Sans-Serif";
font-size: 20px;
font-style: normal;
font-weight: 400;
line-height: 22px;
}
div.tab button:hover {
background-color: #FFFFFF;
color:#336699;
}
div.tab button.active {
background-color: #fff;
color:#336699;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="tab">
<button id="one" class="tablinks" aria-label="LDS Vacuum Shopper Links" >
<img src="https://sep.yimg.com/ty/cdn/vacuumshopper/Icon20.png" height="20" width="20" title="LDS Logo" id="two" name="two">
Vacuum Shopper
</button>
</div>
UPDATE: After searching around I found these JSFiddle's: First JSFiddle and Second JSFiddle and I combined elements from both of them to make the JQuery in the code snippet.