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

254
Views
¿Quiero establecer el cursor de texto en una palabra específica (posición dada en el código a continuación) en un área de texto?

Mi objetivo es hacer clic en el botón y el cursor aparecerá en la palabra asignada al botón dado. He intentado todo lo que puedo disponible en línea. pero nada funcionó. Estoy en la fase inicial de aprendizaje de javascript. Estoy trabajando en un proyecto de blog y necesito insertar un código adicional en estas posiciones dadas, por eso el cursor debe configurarse allí. Ahorrará tiempo.

 <script type="text/javascript"> function StringSearch(clicked_id) { if (clicked_id == 'top6-button-1') { var SearchTerm = 'item-1-end' ; // block of code to be executed if condition1 is true } else if (clicked_id == 'top6-button-2') { var SearchTerm = 'item-2-end' ; // block of code to be executed if the condition1 is false and condition2 is true } else if (clicked_id == 'top6-button-3') { var SearchTerm = 'item-3-end' ; // block of code to be executed if the condition1 is false and condition2 is false } else if (clicked_id == 'top6-button-4') { var SearchTerm = 'item-4-end' ; } else if (clicked_id == 'top6-button-5') { var SearchTerm = 'item-5-end' ; } else if (clicked_id == 'top6-button-6') { var SearchTerm = 'item-6-end' ; } else { var SearchTerm = 'comparing-list-end' ; } var TextSearch = document.getElementById("top6-initial-code").value; if (SearchTerm.length > 0 && TextSearch.indexOf(SearchTerm) > -1) { TextSearch.value = TextSearch.value + "\n"; TextSearch.setSelectionRange(TextSearch.value.length, TextSearch.value.length); TextSearch.focus(); } else { alert("No Data found in Text Area"); } } </script>
 <textarea name="top6-initial-code" id="top6-initial-code" cols="165" rows="40" value="all words i want to put cursor there in textbox, its too big"> <button type="button" id="top6-button-1" onclick="StringSearch(this.id)">Item 1</button> <button type="button" id="top6-button-2" onclick="StringSearch(this.id)">Item 2</button> <button type="button" id="top6-button-3" onclick="StringSearch(this.id)">Item 3</button> <button type="button" id="top6-button-4" onclick="StringSearch(this.id)">Item 4</button> <button type="button" id="top6-button-5" onclick="StringSearch(this.id)">Item 5</button> <button type="button" id="top6-button-6" onclick="StringSearch(this.id)">Item 6</button> <button type="button" id="top6-button-7" onclick="StringSearch(this.id)">Comparison</button>

about 4 years ago · Juan Pablo Isaza
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!