Click a team, it’ll run an alert. This is much like the previous example in ‘Extract Elements’, but ssHasClass() is used when deciding which links to attach the events to.
Click a team, it’ll run an alert.
This is much like the previous example in ‘Extract Elements’, but ssHasClass() is used when deciding which links to attach the events to.
Once the document has loaded, we loop through all the <a>’s in the document.
As we loop through, we detect those which have the class “alert” and if so, we attach the function showAlert() to their ‘click’ event.
This introduces ssHasClass.
Another approach is demonstrated by ssGetElementsByClass.