jquery - Using Javascript variables within a string -


this question has answer here:

i using jquery output link webpage. part of link dynamic, , having trouble using variables , text together. variable gets treated text. doing wrong?

my jquery:

var new_collection_id= 1; var new_collection_title= 'this title';  .html('<a href="collection.php?id=1&collection=new_collection_id">      new_collection_title </a>') 

you need use concatenation.

.html('<a href="collection.php?id=1&collection=' + new_collection_id + '">' + new_collection_title + ' </a>') 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -