This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The CSS is pretty basic. The important part is to make sure your holder DIV has the exact same font family | |
and font size as your Input. We can't /actually/ calculate the width of a font, so we cheat. We do this by | |
copying whatever text is in the Input into a hidden DIV. That Div is set to expand its width as the content | |
changes. We can then guess about how wide the block of text is. I set a max-width on the DIV so that it won't | |
push the suggestions list too far off the screen, even though we account for that in the keypress function. | |
*/ | |
.holder { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var event = new Event('build'); | |
// Listen for the event. | |
elem.addEventListener('build', function (e) { ... }, false); | |
// Dispatch the event. | |
elem.dispatchEvent(event); |