javascript - Value of button as a 2-word variable -


i've looked up, haven't found two-word variables. i'm trying set button value variable, name, 2 words. i've tried 2 different ways, both end printing first name, , not both.

var $div = $("<div></div>");     (var = 0; < people.length; i++) {     $div.append(             "<p>"             + "<input type='submit' value="+people[i].name+" id="+i+">"             + "</p>"             + "<br>"     ); } $("#left2").append($div); 

and i've tried this:

    (var = 0; < people.length; i++) {         $("#left2").append(             "<p>"             + "<input type='submit' value="+people[i].name+" id="+i+">"             + "</p>"             + "<br>"         );     } 

why printing out first name, , not both?

edit: everyone! wish accept answers, got upvote. appreciate taking taking time answer this!

put value in quotes.try this:

"<input type='submit' value='"+people[i].name+"' id='"+i+"'>" 

ideally, attribute value must in quotes.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -