我有一个文本框#search_text。在 keyup 上,我创建了一个 div#sresult_container。并将某些 div 附加到 div#sresult_container。当此容器显示在画布上时,我尝试将单击和鼠标悬停事件绑定到 div#sresult_container。我尝试以下代码,但那不起作用。我该怎么办?
$("#search_text").keyup(function(e) {
if (e.which != 40 && e.which != 38) {
$("#search").removeAttr('disabled');
$.post('http://www.allinone.com', {
Search: sVal
}, function(data) {
$sresult_container = $('<div id="sresult_container"></div>');
//somecode which create another divs and append to the $sresult_container
})
}
$('#sresult_container').bind({
click: function(e) {
//some code
},
mouseover: function(e) {
//some code
}
});
});