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

141
Vistas
How to send data to custom element setter method by Jquery?

I want to know, how to send data to a custom element by jquery. it is possible?.

I have a javascript vanilla code example over here, for understanding my question :

// My custom element class
class MyCustomElementExample extends HTMLElement {
  set customData(data) {
    this._data = data;
    this.render();
  }

  render() {
    this.innerHTML = `<h1>${this._data.name}</h1>`;
  }
}

customElements.define('my-custom-element-example', MyCustomElementExample);

// select my custom element and send data to'customData'(setter method)
document.querySelector('my-custom-element-example').customData = {
  name: "DERI KURNIAWAN"
};
<body>
  <my-custom-element-example></my-custom-element-example>
</body>

This is my specific javascript vanilla code for sending data to setter method :

document.querySelector('my-custom-element-example').customData = {name: "DERI KURNIAWAN"};

So is there a way to do that? or is there a special way? maybe if I think of the code like this:

$('my-custom-element-example').customData = {name: "DERI KURNIAWAN"};
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

document.querySelector('my-custom-element-example')

and

$('my-custom-element-example')

Do exactly the same: retrieve a reference to a DOM element

But the jQuery version requires loading a 50KB+ library

jQuery was great in the age when all Browsers behaved different.

.querySelector and .querySelectorAll are the JavaScript standards;

IE9 was the last browser to implement these standards... in 2011

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