Decoding the function programme

Hello,
I am not able to execute the function when I click on the button.
Here is my code.
THE HTML CODE:-

KEERTHANA

Click below to find my name.

Click here

Hello,My name is:

JS CODE:- function first(myname){ var elem=document.getElementById("hello"); elem.innerHTML=elem.innerHTML+myname; }

Well, make sure that java file is saved with same name as in html source. Also check ur HTML syntax and element ID. I have also attached solution for further clarification. Go through it.

Hello @keerbidare2001
First create my-javascript.js file

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

than create webpage.html file

<!DOCTYPE html>
<html>
<head>
	<title>JavaScript Function</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('KEERTHANA');"> SHOW MY NAME </button>
	<p id= "hello">Hello Everyone, I am:</p> 
</body>
</html>.

Open webpage.html file in browser.
Hope this information is useful for you :+1:

@venkatarohit5
Thank you !
Your solution helped

@chetan.kandarkar99
Thank you!
This was of great help!