Mr Geek Mr Geek - 1 year ago 88
Javascript Question

Is there a script attribute in HTML5

Is there a script attribute in HTML for JS, like the style attribute for CSS, I asked this because I'm using an IDE that highlights script attributes inside elements, so I thought it might exist, and if it does, how to use it ?

<element style="it exists, and i know how to use it" script="no clue">...</element>

Answer Source

HTML5, like previous HTML elements, does not have script attribute but has a script element: You can either put some script directly between two <script> and </script> tags, or use the script element to refer to an external JavaScript file. The JavaScript itself can than dynamically (e.g. on load) add event listeners to HTML elements that need to respond to specific events.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download