开发者

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. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜