JSFiddle - React, Tailwind, and code Playground

HTML

<span st_url="http://localhost:8888/careers/php-web-developer-2"
st_title="PHP Web Developer 2" class="st_facebook_large" displaytext="facebook"
st_processed="yes"></span>

JavaScript

$('span').attr('st_url', function(i, url) {
   var to = url.lastIndexOf('/') +1;
   
  x =  url.substring(0,to);
    alert(x);
})