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

93
Views
Los elementos de acceso de Javascript con la misma propiedad no funcionan

Tengo dos elementos HTML con el mismo name y class propiedades, ¿cómo puedo acceder a las mismas propiedades con un código javascript?

mi html

 <section id="main" class="main-section"> <input id="1" name="subrub-input" id="subrub" class="subrub" type="text" /> <input id="2" name="subrub-input" class="suburb" type="text"/> </section>

mi Javascript

 <!-- <script src="./script/placeholder.js"></script> --> <script> timeout_var = null; function typeWriter( selector_target, text_list, placeholder = false, i = 0, text_list_i = 0, delay_ms = 200 ) { if (!i) { if (placeholder) { document.getElementsByName(selector_target).placeholder = ""; } else { document.getElementsByName(selector_target).innerHTML = ""; } } txt = text_list[text_list_i]; if (i < txt.length) { if (placeholder) { document.getElementsByName(selector_target).placeholder += txt.charAt(i); } else { document.getElementsByName(selector_target).innerHTML += txt.charAt(i); } i++; setTimeout( typeWriter, delay_ms, selector_target, text_list, placeholder, i, text_list_i ); } else { text_list_i++; if (typeof text_list[text_list_i] === "undefined") { setTimeout( typeWriter, delay_ms * 5, selector_target, text_list, placeholder ); } else { i = 0; setTimeout( typeWriter, delay_ms * 3, selector_target, text_list, placeholder, i, text_list_i ); } } } text_list = ["Lorem ipsum", "Tap here your search", "it's fine !"]; return_value = typeWriter("subrub-input", text_list, true); </script>
  1. ¿Cómo puedo acceder al elemento por " mismo nombre " o por " mismas clases " o por "querySelectorAll()".

  2. Un solo elemento es accesible para mí mediante el uso de querySelector

about 4 years ago · Santiago Gelvez
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!