I am trying to append a html tag for an ‘onkeyup’ event. But I need to have it do it only on the first keyup event.
<label for="url">Add URL of your webpage:</label>
<input type="text" id="url" name="url" value="" placeholder="Optional" onkeyup="addlink();"/>
I am using jquery append() function to achieve it. I am not able to find a solution on how to make sure that the event gets fired only on the first keyup. And does not get fired after that. Also if all the content from the text input is deleted I want the remove what I have appended.
Is there any way to achieve it. I hope I have explained myself.
try the following code it will help
the jQuery
one()event fires only once for the given element