简体   繁体   中英

How to make jquery autocomplete to work for a contenteditable DIV instead of just INPUT, TEXTAREA fields

The jquery autocomplete provided by http://docs.jquery.com/Plugins/Autocomplete can work on a INPUT field or a TEXTAREA field. I have a use-case to make a DIV element act as a TEXTAREA by setting its attribute to contenteditable="true". Can I use the DIV's DOM handle for the autocompleter to behave as a textarea for the autocompleter. Currently the plugin 'as is' is not working for the DIV. What changes should I do for the plugin to work for all the above elements?

Tags on a page matter. If your div wants to act like a textarea, maybe it should be a textarea styled to look like a div. You can render your html in a separate div and position it on top of the text area.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM