How to escape src url to insert custom value? My targer:
<script src="https://url.com?value=MY_ESCAPED_CUSTOM_VALUE"></script>
How to escape src url to insert custom value? My targer:
<script src="https://url.com?value=MY_ESCAPED_CUSTOM_VALUE"></script>
 
    
    Try this :
    var x=document.querySelector("[src^='https://url.com']");
    var url=x.getAttribute('src');
    var value=url.substring(url.lastIndexOf('='),url.length-1);
    url=url.replace(value,YOUR_CUSTOM_VALUE);
    x.setAttribute("src", url);
 
    
    var url="https://some.url?value=" + MY_ESCAPED_CUSTOM_VALUE;
<script src={url}></script>
