I want to create a dynamic list.
It can be select option or dropdown or any other list type.
I want to be able to add new options if the current list does not include the desired option.
I want to use a separate button which pops up a new field which allows the user to add a new value to the list.
How can I do that?
The blue coloured part of this picture shows some code which is producing a pop up in background
答案 0 :(得分:0)
使用jquery 给你的选择和输入框提供一个类名,然后按钮
$(".your button class").click(function(){
var op=$(".your input class").val();
var data="<option>"+op+"</option>";
$(".your select class").append(data);
});