Hello I am trying to store some html output in a JS var to output it to the page using "getElementById"...
The problem I am having is with single quotes versus double quotes and when to wrap them within each other...
here is my code:
var buttonOutput1="<br/>";
var buttonOutput2="<button onclick="DealCard('player')">Hit</button>";
var buttonOutput5=buttonOutput1+buttonOutput2;
document.getElementById('buttonArea').innerHTML = buttonOutput5;
I know a little about this, I know you can enclose something within single quotes and then enclose that within double quotes and it all works fine.
But because I want to store it all in a variable, I need to enclose it all in a third set of quotes and so therein is my problem.
So just stuck on what I should do here, wondering if anyone can help on this.
Thanks, G
**** My solution 12:51PM EST ****
Was able figure this out by breaking it into pieces:
var buttonOutput1="<br/>";
var buttonOutput2a="DealCard('player')";
var buttonOutput2b='<button onclick="' + buttonOutput2a + '">Hit
Me</button>';
var buttonOutput5=buttonOutput1+buttonOutput2b;
document.getElementById('buttonArea').innerHTML = buttonOutput5;