Created
January 22, 2020 01:02
-
-
Save omnisonic/9b80bbeb8329b20041947e6bdf3f1b9a to your computer and use it in GitHub Desktop.
ZEYVKjL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<p>An unordered list:</p> | |
<ul> | |
<li>Coffee</li> | |
<li>Tea</li> | |
<li>Milk</li> | |
</ul> | |
<p>Click the button to display text from the document.</p> | |
<button onclick="showOnclick()">Try it</button> | |
<p id="demo"></p> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var para = document.getElementsByTagName("p"); | |
i = 0; | |
function showOnclick() { | |
document.getElementById("demo").innerHTML = para[1].innerHTML.charAt(i); | |
i += 1; | |
console.log(para[1].innerHTML.charAt(i)); | |
} | |
//for (var i = 0; i < para[1].innerHTML.length; i++) | |
// showOnclick(para[1].innerHTML.charAt(i)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment