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

133
Views
Agregue texto del campo a una URL y abra la URL en una nueva pestaña

Si tengo el siguiente div

 <div class = "someclass"> 1234 </div>

y un simple botón html en mi sitio. Cuando el usuario hace clic en el botón, quiero ejecutar una función que tomará el contenido de ese div con la clase "alguna clase" (en otras palabras, 1234) y lo agregará a la URL, por ejemplo, https://www.externalsite.com /parameter=(contenido del div) y abre esa url en otra pestaña. Entonces, la URL final es https://www.externalsite.com/parameter=1234 . Todo lo anterior al parámetro en la URL siempre permanece igual. Gracias por adelantado

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

0

Puede usar HTMLElement.innerHTML:

 let url="https://www.externalsite.com/parameter=" // definie url first part let btn=document.getElementById('click') // get the button element btn.addEventListener('click',function() {url+=document.getElementById('someid').innerHTML}) open(url)
 <div id = "someid"> <!--the id will be unique, but more element can have the same class attribute--> 1234 </div> <button id="click"></button>

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!