4
Is there any way to use the hover
with jQuery in dynamically created selects options. I tried to use the function on()
and the live()
but it didn’t work out.
I tried so:
$(document).on('hover', '.teste', function () {
alert("teste");
});
$(document).live('hover', '.teste', function () {
alert("teste");
});
$(document).delegate('hover', '.teste', function () {
alert("teste");
});
$('.teste').hover(function () {
alert("teste");
});
I also tried with mouseover()
in place of hover()
try the following $("context"). delegate("#id", "acao", Function(e){ ... }) Example: $(" body "). delegate("#Uf", "Hover", Function(e){ .. })
– Thomas Lima
Add an example of what you have tried to do
– Gabriel Rodrigues
Depending on the jQuery version of this
delegate
and thelive
were replaced byon
.– Diego Souza
Try it with mouseenter
– Ricardo Afonso
@Zoom true, well observed!
– Thomas Lima
@Joabnunes no . delegate() you reversed the order... first is the element and then the action: $("body"). delegate(". Uf", "Hover", Function(){})
– Thomas Lima