开发者

Dynamically build dropdown list using Jquery opens and closes immediately

开发者 https://www.devze.com 2023-02-19 21:30 出处:网络
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:

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

精彩评论

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