JSFiddle - React, Tailwind, and code Playground

by yoowordpress

HTML

<div>
    <a href="http://stackoverflow.com/questions/6644654/parse-url-with-jquery-javasc/">dddd</a>
</div>

JavaScript

var url = $('div').find('a').attr('href');
var url = url.replace(/\/$/, '');
var lastSegment = url.split('/').pop();
alert(lastSegment);