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

136
Vistas
Get value of select label html via custom attr

I want to know how to get with jquery with method val() the selected value of a select tag through a custom attribute inside it.

Example:

<select dta-tble="table1" onchange="printTable(event);">
var datatable = $(evt.target).attr("**dta-tble**");

var row = $(**..this the solution..**).val();

Thanks.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

try:

var value = $('select[**dta-tble**="table1"]').val();

I recomand you don't use ** characters on html attributed, use example data-table="table1" or id="table1" and you can get value more easly

about 4 years ago · Juan Pablo Isaza Denunciar

0

If you're using jQuery, dont use inline event handlers. You can target elements using the attribute selector

$("select[dta-tble]").on("change", function(){
    const val = $(this).val();
    console.log(val);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<select dta-tble="table1">
  <option>1</options>
  <option>2</options>
  <option>3</options>
</select>

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