Reputation: 2663
I cannot seem to get the quotes around this statement right. No matter what combination I try. I am really confused on how it should be quoted.
$(#imagearea).append("<img id='"+theWord.charAt(i).toUpperCase+"'.png'" src='images/'+theWord.charAt(i).toUpperCase+"'.png'/>");
Upvotes: 0
Views: 120
Reputation: 2016
Make it less confusing by putting it in two lines.
var myChar = theWord.charAt(i).toUpperCase();
$('#imagearea').append('<img id="'+myChar+'.png" src="images/'+myChar+'.png" />');
Upvotes: 3
Reputation: 1050
$('#imagearea').append("<img id='"+theWord.charAt(i).toUpperCase+".png' src='images/"+theWord.charAt(i).toUpperCase+".png'/>");
Try this one
one main mistake is $('#imagearea'), u have missed the single quotes
Upvotes: 0
Reputation: 23555
Try this:
$('#imagearea').append("<img id='"+theWord.charAt(i).toUpperCase+".png' src='images/"+theWord.charAt(i).toUpperCase+".png' />");
It should append this:
<img id='x.png' src='images/x.png' />
Upvotes: 1
Reputation: 17334
$('#imagearea').append("<img id='"+theWord.charAt(i).toUpperCase+".png' src='images/'"+theWord.charAt(i).toUpperCase+".png'/>");
Upvotes: 0