Festim Dehar
Festim Dehar

Reputation: 117

Jquery hovers all elements

I am trying to implement jquery hover function into my div elements, so I have a div that firstly it is not shown , so i hide it with css, display:none and i am using jquery hover to show it, so this is my code

$('.fc-day-grid-event').hover(
  function() {
    $(".hidenDiv").css("display", "inline-block");
  },
  function() {
    $(".hidenDiv").css("display", "none");
  }
);

but when i hover through the element , all elements with the class .fc-day-grid-event shows the hidden div , it should show the hidenDiv only in the element that i hover

Upvotes: 1

Views: 51

Answers (1)

Satpal
Satpal

Reputation: 133403

Use Context Selector or .find() to target the child of current fc-day-grid-event element

$('.fc-day-grid-event').hover(function () {
    $(".hidenDiv", this).css("display", "inline-block");
    //$(this).find(".hidenDiv").css("display", "inline-block");
}, function () {
    $(".hidenDiv", this).css("display", "none");
});

Upvotes: 3

Related Questions