What is the mistake ??
-
Hi all, i am beginner and learning. below my sample code. demo is working and demo1 is not , what the mistake i have done
<!DOCTYPE html>
<html>
<body><h1>My First JavaScript</h1>
<p id="demo1">
what the hell is going on.
</p>
<p id="demo">
JavaScript can react to events. Like the click of a button.
</p><script>
function myFunction()
{
document.getElementById("demo").innerHTML="Hello JavaScript!";
doucment.getElementById("demo1").innerHTML="This is not working";
}
</script><button type="button" onclick="myFunction()">Click Me!</button>
</body>
</html>Thanks Joe
-
Hi all, i am beginner and learning. below my sample code. demo is working and demo1 is not , what the mistake i have done
<!DOCTYPE html>
<html>
<body><h1>My First JavaScript</h1>
<p id="demo1">
what the hell is going on.
</p>
<p id="demo">
JavaScript can react to events. Like the click of a button.
</p><script>
function myFunction()
{
document.getElementById("demo").innerHTML="Hello JavaScript!";
doucment.getElementById("demo1").innerHTML="This is not working";
}
</script><button type="button" onclick="myFunction()">Click Me!</button>
</body>
</html>Thanks Joe
You misspelled "document" as "doucment" on the "demo1" line. If you look in the Javascript console, there should be an error message saying something like "doucment is not defined" - when something in JS fails to work, you should look there first.
-
Hi all, i am beginner and learning. below my sample code. demo is working and demo1 is not , what the mistake i have done
<!DOCTYPE html>
<html>
<body><h1>My First JavaScript</h1>
<p id="demo1">
what the hell is going on.
</p>
<p id="demo">
JavaScript can react to events. Like the click of a button.
</p><script>
function myFunction()
{
document.getElementById("demo").innerHTML="Hello JavaScript!";
doucment.getElementById("demo1").innerHTML="This is not working";
}
</script><button type="button" onclick="myFunction()">Click Me!</button>
</body>
</html>Thanks Joe
Hello Joe, spelling mistake in second statement. document Regards, J Sampath Kumar, Osmosys
-
Hi all, i am beginner and learning. below my sample code. demo is working and demo1 is not , what the mistake i have done
<!DOCTYPE html>
<html>
<body><h1>My First JavaScript</h1>
<p id="demo1">
what the hell is going on.
</p>
<p id="demo">
JavaScript can react to events. Like the click of a button.
</p><script>
function myFunction()
{
document.getElementById("demo").innerHTML="Hello JavaScript!";
doucment.getElementById("demo1").innerHTML="This is not working";
}
</script><button type="button" onclick="myFunction()">Click Me!</button>
</body>
</html>Thanks Joe
<!DOCTYPE html>
<html>
<body><h1>My First JavaScript</h1>
<p id="demo1">
what the hell is going on.
</p>
<p id="demo">
JavaScript can react to events. Like the click of a button.
</p><script>
function myFunction()
{
document.getElementById("demo").innerHTML="Hello JavaScript!";
document.getElementById("demo1").innerHTML="This is not working";
}
</script><button type="button" onclick="myFunction()">Click Me!</button>
</body>
</html>Try this... there is miss Sppell in document
-
Hi all, i am beginner and learning. below my sample code. demo is working and demo1 is not , what the mistake i have done
<!DOCTYPE html>
<html>
<body><h1>My First JavaScript</h1>
<p id="demo1">
what the hell is going on.
</p>
<p id="demo">
JavaScript can react to events. Like the click of a button.
</p><script>
function myFunction()
{
document.getElementById("demo").innerHTML="Hello JavaScript!";
doucment.getElementById("demo1").innerHTML="This is not working";
}
</script><button type="button" onclick="myFunction()">Click Me!</button>
</body>
</html>Thanks Joe
<script>
function myFunction()
{
document.getElementById("demo").innerHTML="Hello JavaScript!";
document.getElementById("demo1").innerHTML="This is not working";
}
</script>spelling mistake
ajd