4 ms·
As I understand it, the main point of that section is what to do with the onclick handler vs. what to do with the href attribute. You can follow the suggested p
by joshuahedlund 15y ago
As I understand it, the main point of that section is what to do with the onclick handler vs. what to do with the href attribute. You can follow the suggested practices regardless of whether you put your onclick code inside the element (as in the simple example) or in the script tag (as you rightly recommend).
- firefoxman1 15y agoYeah, the author is basically telling you to use what is now considered a bad practice (onclick) instead of a worse practice such as... href="javascript: dostuff()"
- iamds 15y agowhat is now considered good practice?
- firefoxman1 15y agoEver since the term "unobtrusive javascript" came into play, it's been considered best practice to have all scripts loaded externally, then select the element and attach a listener to it.