how do you check if a string/text still exist in an HTML element particularly <input>?
i have this code $("input").bind('paste', function(e) { that captures paste events and checks if the pasted text contains a youtube url, parse it via regex and simply print the youtube url in a <div> element.
how can i make javascript to delete the printed data, if the link is removed/deleted in the input element
here is a sample: http://jsfiddle.net/8Pvr4/5/
input any youtube url in the textfield, and it should display something. then remove the url, the data still remains.
basically i just want the printed output to disappear once the existence of the url is removed in my input
initial thought was adding some onChange event to the input but im not quite sure how can i do it without messing the current code.
ctrlandvso it prints the result twice. and pasting using mouse is not recognized.