typeahead.js icon indicating copy to clipboard operation
typeahead.js copied to clipboard

Clearing content - suggestions not cleared

Open steswinbank opened this issue 13 years ago • 1 comments

I think there is a bug in the plugin to do with removing content from the input box typeahead() is applied to.

Steps to replicate:

  1. Type something into text input, e.g. 'word'
  2. Use Jquery in browser console to clear the content, e.g. $('#InputBox').val('')
  3. Observe blank text input
  4. Click into text input (to give text input focus)
  5. Click out of text input (to remove focus)
  6. Observe content 'word' appearing in the text input.

I am applying a 'remove-content' button in the right-hand-side of the text input for users to remove content on-click. This button runs code: $('#InputBox').val('') but the bug I've identified means this isn't working as desired.

Interestingly, if you change the type of the input to 'search' and use the in-built remove-content-cross then it circumvents this bug. Unfortunately our inputs need to be type='text' on our site. Also, the in-built remove-content-crosses cannot be custom styled.

A fix for this would be great. Thanks :)

steswinbank avatar Apr 08 '13 15:04 steswinbank

Yes, I've been able to fix it now. Thanks for your help!

steswinbank avatar Apr 09 '13 08:04 steswinbank