Simple question - how do I make an element appear to be hovered when I trigger it from another element?
Example jsfiddle: http://jsfiddle.net/xpvt214o/391305/
Body:
<span class="itemA"></span>
<button>
TriggerAHover
</button>
Js:
$(document).ready(function(){
$('button').on("click", function(){
$('.itemA').trigger('mouseover');
})
});
Css:
.itemA {
display:block;
background: blue;
width: 40px;
height: 40px;
}
.itemA:hover {
background: red;
}
This fiddle creates a blue background span. On hover, the span changes red.
I want the span to also change to a hovered state on click of the button. I've tried .trigger('mouseover'), .trigger('mouseenter'), and .trigger('hover'), but they do not change the span element to its hovered state.