Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: Declaring an empty element before insertAdjacentHTML

codeDragon:

Hi I have a simple question, do I need to specify lblWelcomeUserMessage.innerHTML = ""; ( see below in code ) in the following function before insertAdjacentHTML on it ? It actually works as it is without declaring it, but I want to know what is the optimal approach ?


// Dynamic HTML / user interface for ALL users
function showWelcomeMessage() {

//lblWelcomeUserMessage.innerHTML = "";

var sWelcomeUserMessage = '

' + 'Welcome:' + ' ' + sessionStorage.getItem( 'name' ) +
' ' + sessionStorage.getItem( 'lastname' ) + ' ' + sessionStorage.getItem( 'role' ) + '

';
var iUserImage = '';
lblWelcomeUserMessage.insertAdjacentHTML( 'beforeend', sWelcomeUserMessage + iUserImage );
}



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: Declaring an empty element before insertAdjacentHTML

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×