innerHTML within another tag

Posted by jimbo on Stack Overflow See other posts from Stack Overflow or by jimbo
Published on 2010-06-03T13:30:30Z Indexed on 2010/06/03 13:34 UTC
Read the original article Hit count: 198

Filed under:

Hi all,

I have a link:

<a id="nextBut" href="somelink" class="button"><span>Next Step</span></a>

And I can control the the <span>Next step</span> part with innerHTML but how could I leave the <span> alone and just change the 'Next step' part?

For example:

var NextButJar = document.getElementById('nextBut');
NextButJar.disabled = true;
NextButJar.style.opacity = .5;
NextButJar.span.innerHTML = 'Read all tabs to continue';

I also have:

NextButJar.onClick = handleClick;
function handleClick(){
    if (this.disabled == true) {
        alert("Please view all tabs first!");
        return;
    } else {
        alert("allowed to run");
    }
};

Which I can't seem to get working either...

© Stack Overflow or respective owner

Related posts about JavaScript