Jump to content

Finally get rid of <script> tags


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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...