1
var productInfo= $('#product-info'+PID).html();  
console.log(productInfo); // this works fine
        var pinfoID='padded-info'+PID; // this is okay

now I want to wrap product info as follows:

   productInfo='<li id="'+pinfoID+'">
                          <div class="alert alert-success">
                            <button type="button" class="close" >×</button>
                            <strong>'+productInfo+'</strong> 
                        </div>
                 </li>';

But it does not works. What is wrong am I doing?

1
  • Can you should your full code please? Commented Jul 5, 2015 at 9:45

1 Answer 1

2

Appear to be redefining productInfo ? Try providing different variable name to final html fragment

   var productInfoHtml = '<li id=' + pinfoID + '>'
                          + '<div class=alert alert-success>'
                          + '<button type=button class=close>×</button>'
                          + '<strong>' + productInfo + '</strong>' 
                          + '</div></li>';
Sign up to request clarification or add additional context in comments.

1 Comment

Uncaught SyntaxError: Unexpected token ILLEGAL near '<li id="'+pinfoID+'">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.