The following is code that is within an html file. What is the ideal way to separate the JavaScript code (if (this.value etc etc)) from html file?
input type="text" name="username" onblur="if (this.value == '') {this.value = 'email';}" onfocus="if (this.value == 'email') {this.value = '';}"
If you want to put the JavaScript content into an external file:
HTML file:
utils.js file:
Related links:
script element,
onblur event,
onfocus event.