Reputation: 2596
I am trying to raise a mouseenter
event for an element, when hovering over another element. I am trying to find the element based on a data attribute:
$("#modal").on("mouseenter", ".jq_pin", function(e) {
var attr = $(this).data("abbr");
var els = $(".jq_mapPoint");
var el = els.find("[data-abbr='" + attr + "']");
el.trigger(e.type);
});
My event fires, and debugging I can see a list of elements with jq_mapPoint
class, and one has a matching data attribute, but the length of el is always 0.
Element with event:
<li class="jq_pin"data-abbr="N">HI</li>
Element Im trying to target:
<div style="position:absolute;left:59%;bottom:72%" class="jq_mapPoint" data-abbr="N">N</div>
Upvotes: 0
Views: 66
Reputation: 9482
It probably needs the All selector *
:
theels.find("*[data-abbr='" + attr + "']");
Upvotes: -1