mercredi 5 août 2015

Binding mouse events to dynamically created select


I have created select tag dynamically in jquery function. I want to bind the mouse events to it. I have dynamically created the selct tag

function loadValues()
{
var sel='<select id="flavor_slct'+index+'" class="popper" data-popbox="pop1"     

onclick="alert()">'+flavor_fetched_string+'</select>';
$("#attach").append(sel);

}

I have tried using the .on() jQuery function. Still events are not triggered.

$("body").on("hover","Select",function()
    alert("hovered");
)};

How should i bind events to dynamically created elements.?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire