Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

281
Vistas
TamperMonkey Script

I am trying to change a <textarea> field in an HTML login page into an <input> field, dynamically, on page load.

<div class="field input-field">
    <span class="user-icon">
    </span>
    <textarea class="qStr" data-qstrph="LDAP_SERVER_STR12" id="username" autocomplete="off" placeholder="Username">
    </textarea>
    <span class="reset-icon slice-img">
    </span>
</div>

The first thing I thought of was TamperMonkey, and using JavaScript to do this.

I reached out to a friend of mine, who is far more talented than I am, and asked him to make a small JavaScript bit to do what I'm wanting. He quickly came back with this:

const originalItem = document.getElementById("username")
const newItem = document.createElement("input")
newItem.setAttribute("type", "text")
newItem.setAttribute("class", "qStr")
newItem.setAttribute("data-qstrph", "LDAP_SERVER_STR12") 
newItem.setAttribute("id", "username")
newItem.setAttribute("autocomplete", "off")
newItem.setAttribute("placeholder", "Username")
originalItem.replaceWith(newItem)

When I run this snippet in the Chrome developer console, it does exactly what you'd expect it to do, and that's awesome! When I take the same block and put it into TamperMonkey, save the file, and make sure its an enabled script, and reload the HTML page -- nothing happens -- and this makes me sad:

Here is the code, as it is in TamperMonkey:

A screenshot showing code from a tampermonkey script

I'm not sure what I'm not doing right, as the code worked perfectly in the dev console.

Your input is appreciated, thank you!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda