I have h1 tag, which id called "step1". I would like to add link for that with Javascript. So i trying to code with javascript as follow:
div = document.getElementById('step1');
newlink = document.createElement('a');
newlink.setAttribute('class', 'heading');
newlink.setAttribute('href', 'javascript:showStep(2);');
div.appendChild(newlink);
But it render only this way. <h2 id="step1">Step<a href="javascript:showStep(1);" class="heading"> in HTML.
Actually I want following result as :
<h2 id="step1"><a href="javascript:showStep(2);"
class="heading">Choose Desired Services</a></h2>
So please help me to create this.