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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -