Prev Demo
Replacing The Elements In A String With The Global Search.
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Replacing the elements in a string with the global search.</h1> <p>Click the below button to replace the Emirates with Lufthansa.</p> <input type="button" value="Replace" onclick="Function()" /> <p id="myId">Emirates flights having Emirates girls, Emirates logo tags</p> <script> function Function() { var a = document.getElementById("myId").innerHTML; var r = a.replace(/Emirates/g, "Lufthansa"); document.getElementById("myId").innerHTML = r; } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output