This is my javascript code below (Just to get current url)
<html>
<head>
</head>
<body onload="myFunction();">
<p id="myurl"></p>
<script>
function myFunction() {
document.getElementById("myurl").innerHTML =
window.location.host;
}
</script>
</body>
</html>
And Now i want to use
<p id="myurl"></p> as below: <a href="https://www.facebook.com/sharer/sharer.php?u=<p id="demo"></p>">Share on Facebook</a> <br>
But as it cant be execured inside href="value"
Is there any way to do that with php or something else?