Reputation: 69
I write this javascript but it's showing error. can anyone solve this how to write it correctly?
actually I want to show button and on the button, I want link
pop_str = pop_str + '<a href="'+ brand1 + 'vs' + brand2 + '/'><button class="btn master_btn">Compare Now!<button></a>';
Upvotes: 0
Views: 531
Reputation: 22490
Remove the quote
on '/'
=> '/
pop_str = pop_str + '<a href="'+ brand1 + 'vs' + brand2 + '"/><button class="btn master_btn">Compare Now!<button></a>';
Upvotes: 4
Reputation: 2190
To simplify this you could use the back tick character `
:
pop_str = `${pop_str}<a href="${brand1}vs${brand2}"><button class="btn master_btn">Compare Now!<button></a>`
You simply place your variables within ${variable}
Upvotes: 2