开发者

How to Add textbox item to list in jquery?

I am new to jquery .I would like to have the function开发者_开发技巧ality like. User can Add custom text to Text Box and it will add to below List. If user click remove that item then it also reomve from list.

I attached screenshot here. Can any one help me.


you can try below code for your need..

<script type="text/javascript"> 
$(document).ready(function(){
$("#btn_AddToList").click(function(){
    //alert($('input[name=List1]').val());  Its Let you know the textbox's value
    $('input[name=List1]').val().appendTo('#List2');
    });         
});
</script>
<input name="List1" type="text">
<input type="button" id="btn_AddToList" value="Add">
<select id="List2">
<option>---</option>
</select>

Its may helpful to you..

Thanks.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜