I have string show {{value}}
and I want replace {{value}}
with $&
but it not work. It return current value show {{value}}
.
Here is my code
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
let data ="show {{value}}";
let output = data.replace("{{value}}","$&");
alert(output);
});
</script>
</head>
<body>
</body>
</html>
I don’t know why it not work. I try replace with other strings same $1
, $a
and it work.
How I can fix my problem