Excelsior100 Posted October 14, 2022 Share Posted October 14, 2022 I am trying to make a button that says "Click Me", that when clicked, changes the text above it from "Hi" to I'm Clicked!". Here is the source: ---------------------------------------------------------------------------------------------------------------------- <!DOCTYPE html> <html> <body> <p id="demo">Hi.</p> <script> function myFunction() { document.getElementByID("demo").innerHTML = "I'm Clicked!"; } </script> <button type="button" onclick="myFunction()">Click Me!</button> </body> </body> </html> ------------------------------------------------------------------- What am I doing wrong? Link to comment Share on other sites More sharing options...
Ingolme Posted October 14, 2022 Share Posted October 14, 2022 The function name should be getElementById. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now