JSFiddle - React, Tailwind, and code Playground

by Anee

HTML

<div id="mydiv"></div>

JavaScript

var path = "WordsHere-t.jpg"; // Get's the path after host url
var arrypath = path.split("-"); // Split's your substring using "-",
console.log(arrypath[0]); //

$("#mydiv").append(arrypath[0]);