I'm attempting to extract the elements from the source that was clicked on, but for some reason it's not functioning correctly.
Here's the HTML:
<span class="populate" onclick="populate();" href="?id=1">Hello</span>
And here's the CSS:
.populate {
cursor: pointer;
}
Followed by the JavaScript:
function populate(event) {
var event = event || window.event;
var src = event.srcElement;
var href = src.getAttribute('href');
alert(href);
}
I'm seeing an error in the console saying that the populate function is not defined.
If anyone has any suggestions or advice, I would greatly appreciate it!