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

170
Views
button onClick="javascript:calleoChat" funciona bien en Html pero no en un script

en mi html, hay un botón y abre el script de chat-bot.

funciona perfectamente en html.

pero no funciona en mi script.

 ... ... <section> <button type="button" onclick="javascript:calleoChat('startChat')">Try it</button> </section>
 <script> //button creation let btn = document.createElement("button"); btn.innerHTML = "Open Chat-Bot"; //call chat bot script, but it doesn't work btn.onclick = "javascript:calleoChat('startChat')"; node.appendChild(btn); //insert button to selected class document.getElementsByClassName("AddToBagButton__container")[0].appendChild(node); </script>

Consulte mis códigos de muestra anteriores y deme su amable consejo para resolver este problema.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

  1. En un clic, no necesita agregar "javscript:", solo puede poner el código;

onclick="calleoChat('startChat')"

  1. En el script onclick no es necesario poner el script entre comillas;

btn.onclick = calleoChat('startChat');

  1. También puede agregar el evento como un detector de eventos (de esta manera puede agregar más):

btn.addEventListener("click", () => calleoChat("startChat"));

Más información sobre eventos onclick: https://www.w3schools.com/jsref/event_onclick.asp

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!