2

please follow this link: FIDDLE

I'm building this input (that is a search tool) and I'm putting some "tips" to select.

I use an hidden paragraph to store it better.

I have 2 problems:

  1. if you try to select 3 tips and that to deselect all you can see that the hidden text is empty but the input have the last tips selected.
  2. I would like that if I manually type "Hello world" and than I use tips, Hello world stay there always, also if I remove all the tips than.

Thank you in advance for your help.

0

1 Answer 1

1

for your first question, try this code

$(document).ready(function() {
    var lista = $('ul#common-list');
    lista.bind("mousedown", function (e) {
        e.metaKey = true;
    }).selectable({
        stop: function () {
            var result = $("input#search");
            var fakeText = $('p.hidden-tips-text').empty();
            $(".ui-selected", this).each(function () {
                var index = $(this).text();
                fakeText.append((index) + " ");
            });
           result.val(fakeText.text());
        }
    });
});
Sign up to request clarification or add additional context in comments.

2 Comments

Yes it work! Thanks, if you can fix the second one too you're the no.1!
Solved by myself after your help. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.