JSFiddle - React, Tailwind, and code Playground
by David Thomas
HTML
<ol>
<li><a href="http://example.com/tag/helloKitty/">Page: 'helloKitty'</a></li>
<li><a href="http://example.com/tag/phonogram/">Page: 'phonogram'</a></li>
</ol>
JavaScript
function showPage(url) {
if (url.indexOf('tag')) {
var temp = url.split('/tag/')[1];
var curPage = temp.substring(0,temp.indexOf('/'));
return curPage;
}
}
var as = document.getElementsByTagName('a');
for (var i=0,len=as.length;i<len;i++){
as[i].onclick = function(e){
e.preventDefault();
alert(showPage(this.href));
}
}