Set Text of Anchor Tag In Javascript
36,334
Solution 1
It is innerHTML
. JavaScript is case sensitive.
Solution 2
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.
Solution 3
innerHtml should be innerHTML (capitalized 'HTML')
Solution 4
The property name is case sensitive and should be innerHTML
.
Solution 5
You can also use this one:
link.textContent= "Remove";
Author by
Arizona1911
Updated on July 02, 2022Comments
-
Arizona1911 7 months
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";