Write a JavaScript that will replace following specified value with another value in string. String = “I will fail”

Replace fail by pass.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h2>I will <span id="status">fail</span></h2>
    <button onclick="document.getElementById('status').innerHTML='pass'">Click ME</button>
</body>
</html>

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *