开发者

Stop Jquery from replacing the field

I almost got what I want now. (Cobbled together from code all over the internet.)

But I need to know how to keep my query from being over written.

Example I have a text field. When a word on the dropdown is selected it puts the text in to the form field. If I select another word it replaces that word. What I want it to do is to be able to select as much as I want and no matter how many words I touch it'll keep those unless I go up and backspace or delete them out of the form field.

Here's my code.

http://pastebin.co开发者_JAVA技巧m/1wnAZMNM


One way is to append the new text to the input control instead of replacing its contents, possibly inserting a space character in-between:

$(".myselect").change(function() {
    $(".textbox").val($(".textbox").val() + ' ' + $(this).val());
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜