Javascript functions

when iclick on “SHOW ON MY NAME” , The name bolt iot isnt diplayed. please help.
image
and here is the image of the code,
image
and html code is,
image

Hi @dheerajswaroop15,

To debug your issue, check the below details.

  1. Check if your html code and javascript code are in same folder.
  2. Check the error in the console. Open your code in chrome and then right click on the page -> inspect element -> console -> Click on show my name button -> Send the screenshot of the console here.

Also the correct code for my-javascript.js

function myFunction(myName) {
        var elem = document.getElementById("hello");
        elem.innerHTML = elem.innerHTML + myName;
    }

and for index.html

<!DOCTYPE html>
    <html>
    <head>
    <title>JavaScript Functions</title>
    <script type="text/javascript" src="my-javascript.js"></script>
    </head>
    <body>
        <p id="para1">Click on the below to show my name.</p>
        <button onclick="myFunction('Bolt IoT');">SHOW MY NAME</button>
        <p id="hello">Hello World, I am:</p>
    </body>
    </html>