Jump to content

Finally get rid of <script> tags


xcislav

Recommended Posts

Cut the code:

<input onkeyup="s?e=Date.now():s=Date.now()"onblur="c=this.value.length;this.value+=c/(e-s)"><script>s=0</script>

☑ 113

<input onkeyup="s?e=Date.now():s=Date.now()"onblur="c=this.value.length;this.value+=c/(e-s)">

Ø 93

Edited by xcislav
  • Like 1
Link to comment
Share on other sites

neither of those approaches looks appealing in the least. Event handling / listening is recommended instead.

https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener

Link to comment
Share on other sites

Yes, as Scientist says, wouldn't it be much nicer and cleaner to have unified handlers for these inputs? Why would you want all of that embedded code in the HTML? On pageload you would have a loop assign all of the input elements to the same handler functions which would then collect the clickstream data.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...