see this html page

cant understand why they populated the anchor with text this way :
a.appendChild(document.createTextNode('Hide details'));

why not this way with the innerHTML method ??
a.innerHTML = 'View details';

thanks

Three reasons. One, you get an Ajax result that has preformatted html as the response, or a function that does the same. The second reason is laziness. And the third is when it's the right tool for the job.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.