In my page I have a textfield input (with id myname). And when I writing a name in that field, I jusing $.get to get some name-suggestion to the input. All this div objects has a class "sug". And all that data is appended in a div with the id "nameHint".
$("#myname).keyup(function(t){
$.get("getname.php", {q:value}, function(data){
nameHint.removeClass("hid").html(data);
}).fail(function(){nameHint.html("").addClass("hid");});
t.preventDefault();
});
And the div nameHint is showed on the page. And is works perfectly. After that when I click on one of the div, with a class sug, I want something to happend. Lets say I want to print the current div html-cod. I would used this code:
$("div#nameHint div.sug").on("click", function(){
alert($(this).html());
});
But this on-event doesn't do enyting.
What am I doing wrong??