Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
Multiple use of backticks within Javascript

I'm having some trouble using backticks and I'm wondering if anyone can help me. I have the code below which allows me to output multiple responses. The trouble is, when I put a comma after target="_blank">here` it doesn't allow me to add further phrases. I have attempted using a backspace before the backtick to break out of it but no luck. Here is my code, I'm using Javascript and HTML.

<script>
function talk(){
var know ={
        "How does this work":"I can help you find what you're looking for.",
        "how does this work":"I can help you find what you're looking for.",        

        "contact":`You can contact us by clicking <a href='https://addressname.com' target="_blank">here</a>` 
};  

var user = document.getElementById('userBox').value;
document.getElementById('chatLog').innerHTML = user + "<br>";
if(user in know){
    document.getElementById('chatLog').innerHTML = know[user] + "<br>";
}else{
    document.getElementById('chatLog').innerHTML = "I do not understand.";
}
}

</script>

To clarify, I'm needing something like this: (but obviously the comma doesn't work)

"How does this work":"I can help you find what you're looking for.",
        "how does this work":"I can help you find what you're looking for.",        

        "contact":`You can contact us by clicking <a href='https://addressname.com'target="_blank">here</a>`,
        "help":`You can find help by clicking <a href='https://addressname.com'target="_blank">here</a>`
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

As you know the use of " & ' should corresponded to each other

Double quotes around attribute values are the most common in HTML, but single quotes can also be used.
In some situations, when the attribute value itself contains double quotes, it is necessary to use single quotes:

<p title='John "ShotGun" Nelson'>

Or vice versa:

<p title="John 'ShotGun' Nelson">

The backslash (\) escape character turns special characters into string characters .
If there are extra symbols in between you can use \ backslash before them so that they don't interfere with the code and treated as symbols like this :

<p title="John \'ShotGun\' Nelson you\'re a good\\bad person">
It will be displayed like this :
John 'ShotGun' Nelson you're a good\bad person

Refer to this for more about backslash

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!