Search the Blog

Monday, July 29, 2019

Javascript code for sweeping the text - Programming Logic and Code with Syntax

<html>

<head>

<meta content="width=device-width, initial-scale=1">

</head>

<body>

<button onclick="myFunction()">

Click Me

</button>


<div id="myID">www.dizsweb.com</div>

<script>

function myFunction() {
  var x = document.getElementById("myID");
  if (x.innerHTML === "www.dizsweb.com") {
    x.innerHTML = "Programming Logic and Code";
  } else {
    x.innerHTML = "www.dizsweb.com";
  }
}

</script>


</body>

</html>



No comments:

Post a Comment

Translate