• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 96
  • Last Modified:

Help with basic javascript syntax

Can someone tell me what is wrong with the following
  <script type="text/javascript">
  function TextInsert() {
	document.getElementById("MyEdit").innerHtml="My new text!";
  <body onload=TextInsert()>
  <div id="MyEdit">&nbsp;</div>

Open in new window

Gary Samuels
Gary Samuels
2 Solutions
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
javascript is case sensitive, change your code to:

document.getElementById("MyEdit").innerHTML="My new text!";

also, put your function call in quotes:

<body onload="TextInsert():>
Check the case

document.getElementById("MyEdit").innerHTML="My new text!";
Gary SamuelsPlant ManagerAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now