views:

45

answers:

4

How do I set the text of an anchor tag in javascript? This does not seem to work. I'm using firefox.

var link = document.createElement("a");
link.innerHtml = "Remove";
+4  A: 

It is innerHTML. JavaScript is case sensitive.

David Dorward
+3  A: 

The property name is case sensitive and should be innerHTML.

Ryan Tenney
+4  A: 

Property names are case sensitive in Javascript.

Try

link.innerHTML = "Remove";

You will need to attach the created element to the document, too. But I assume you're doing that in the rest of your code.

Pekka
+2  A: 

innerHtml should be innerHTML (capitalized 'HTML')

brianghig