pulling text from url and putting text back in url with javascript -
i have tried googling can't find i'm looking for. have url has number in it. want able take number there , depending on number there interject name url. example:
let's url is: www.example.com/video15637
can take number , like:
var namevariable; if(video15637){ namevariable = video15637; } if(video26597){ namevariable = video26597; } if(video18737){ namevariable = video18737; }
then, somehow interject namevariable url displayed?
you can try with:
var = document.createelement('a'); a.href = 'http://www.example.com/video15637'; var namevariable = a.pathname.substr(1); // video15637
Comments
Post a Comment