We have had quite long chat here with rlemon about DOM manipulation. Basically the question is 'How can I change the UL-LI DOM with Javascript?' For example, suppose I want, instead of "<ul id='uids'><li>1</li><li>2</li></ul>", to display something like this "<ul><li><i>Hello 1, have a nice day!</i></li>...</ul>" — how can I do that just with DOM -manipulation?
I know this is simple question so instead of reinventing-the-wheel, I am happy with references.
Simple demo about DOM manipulation, can you do something like this?
Input
<ul id="uid"> <li>1</li> <li>2</li> </ul>Output
<ul id="uid"> <li>Hello beautful lady 1!</li> <li>Hej gentleman 2.</li> </ul>
Perhaps useful for other newbies to get familiar with functional nature of JS
The short way, using innerHTML:
jsFidlde: http://jsfiddle.net/eZv4D/3/
The long way, with true DOM manipulation:
jsFiddle: http://jsfiddle.net/eZv4D/2/