JSFiddle - React, Tailwind, and code Playground

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/dot-luv/jquery-ui.css">

JavaScript

var textTitle = "this is a test";
var result = textTitle.replace(/ /g, '%20');
alert(result);