Have this code wrapped in HOVER Event…
$("#div_ID").hover(function() {
// perform stuff here...
}
);
I’d like to trigger the above when I click a link using the ONCLICK Event…
$("anchor_ID").click (function() {
$("div_ID").trigger('hover'); // Not sure if this is even correct
}
);
It’s not working though. How can I accomplish this? Is it even possible?
Using JQuery only on FF v16, IE8, and GC v23
How about this:
But if you are set on using
.trigger, your problem might be that you forgot to include#beforediv_ID. And changehovertomouseenter(the “hover” function in jQuery is just a shortcut for “mouseenter” — credit to @FabrícioMatté for catching that) That is:Same might apply to
anchor_ID, but I won’t know unless you post your HTML.Update: another suggestion from @FabrícioMatté: the
thiskeyword inside ofdosomethingmight be a bit confusing when you call it as shown above, so watch out for it. Thethiskeyword will work differently than using.trigger, so it’s just a heads up….