I have a classic case of an input that is cleared when gaining focus.
The problem is that when user goes to copy some data from a spreadsheet e.g. and comes back to add this data to the input, the focus event of the input is triggered and whatever they typed is cleared.
How to prevent onfocus from being triggered when it is due to a browser window focus and not from a click on the input, a tab, the click of a label, or any traditional action in the page?
NO JQUERY PLEASE.
EDIT: OK apparently some people like to vote negatively every time a post does not have some code. So if you need a code to grasp this simple idea, here it is:
<input type=text onfocus="this.value=''">