In the past few days, the function of completely replacing js strings has been used. I don’t say anything, just upload the code and need to copy it away:
The code copy is as follows:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script type="application/javascript">
function testStr(){
var temp=document.getElementById("content").value;
var newContent=temp.replace(/"/g,'/'');
alert(newContent);
}
</script>
</head>
<body>
<textarea id="content"></textarea>
<input type="button" value="work" onclick="testStr();"/>
</body>
</html>
The above code implements the function of replacing quotes, /g means all replacements. Other requirements can be used by changing them. I'll take a note here, hoping it will be helpful to everyone!