JavaScript for WordPress Forums Vanilla JavaScript EventListener Project Reply To: EventListener Project

Zac Gordon

Hey Jason!

My first suggestion would be to make the tab titles actual links. They can have a URL of #tab-x and then the related content area would have related IDs so the links work even if JS isn’t applied (just make sure you are doing the initial hiding of the content via JS so if there is no JS you can still access the content).

You did some good thinking with your accordion code, but you might find tweaking the html like this make it easier. It may also solve your double click issue just with the titles being links with preventDefault applied.

Let me know how that goes..