Y
Hacker News
new
|
ask
|
show
|
jobs
by
aaronblohowiak
5038 days ago
innerHTML is an easy one, try setting an attribute -- you have to create a new attribute node, set its value and then add that to the element..
3 comments
masklinn
5038 days ago
> you have to create a new attribute node, set its value and then add that to the element..
Erm... no you don't:
http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-F68F082
link
gildas
5038 days ago
You should set the node property instead (e.g. standard textContent or innerText). It will work everywhere.
link
mibbitier
5038 days ago
setAttribute()?
link
aaronblohowiak
5038 days ago
IE8 =(
link
Erm... no you don't: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-F68F082