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());
});
精彩评论