Dynamically build dropdown list using Jquery opens and closes immediately
My dynamically built dropdown list opens and closes immediately, I've got no chance of selecting any option, here is how the code of the function that builds the list looks开发者_开发百科 like:
function MoveItem(itemID) {
var selector = "#mov" + itemID;
var replaceValue = "<select class=ddl id=select" + itemID + ">" + $("input:text").map(function() { return '<option>' + $(this).val() || null; }).get().join("</option>");
replaceValue += "</select>";
$(selector).html(replaceValue);
}
Any idea why is it so ? Thks guys.
Bind it to change event. Like $("#yourid").bind("change", MoveItem(this));
I think it will do it. :)
精彩评论