Click a team, it’ll run an alert which extracts the text from that link. The numbers randomise every couple of seconds to emphasise that it extracts the text when you click (not when the event gets attached).
Click a team, it’ll run an alert which extracts the text from that link.
The numbers randomise every couple of seconds to emphasise that it extracts the text when you click (not when the event gets attached).
Once the document has loaded, we loop through all the <a>’s in #main, and attach showAlert(e) to each one’s ‘click’ event.
The function showAlert(e) extracts the current text from the link and passes it to an alert().
This introduces ssExtractEl and ssStopTheRest.
It also shows the native JavaScript syntax el.innerHTML, self.setTimeout and Math.random in use.