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";
It is innerHTML
. JavaScript is case sensitive.
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.
innerHtml应该是innerHTML(大写'HTML')
属性名称区分大小写,应该是innerHTML
。
你也可以用这个:
link.textContent= "Remove";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.