I am adding some elements dynamically and assigning a hover property to it in delegated event handlers for which I used below code and it did not work.
$(document).on("hover", ".sec_close_fast", function() {
$(this).parent('div').parent('div').css("border", "3px solid #000000");
});
Then I used mouseover
and it worked:
$(document).on("mouseover", ".sec_close_fast", function() {
$(this).parent('div').parent('div').css("border", "3px solid #000000");
});
I would like to know why hover
does not work, yet mouseover
does.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…