I have an input field where a user can paste a link. I would like to have a div appear as soon as the user adds a URL to the input field.
Until now I used .blur and .onfocus, but the div only appears once I click outside the input field after pasting the URL.
It’s like on Facebook: as soon as you paste a link it will load a box without reloading the page.
.bluris the opposite of.focus— it triggers when the specified field loses focus. You need to use something that triggers every time a key is pressed, like.keyupNote that
.changewill not work — it also only fires when the field loses focus