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

126
Vistas
using a WooCommerce,i wanted the product attribute "color section" to be hidden/disable when a customer clicked "stock" in product price and idk how

function hideStock(){
        var selected = document.getElementById("stk");
        var hidden = document.getElementById("pa_color");
        if (selected.onchange=="stock") {
                hidden.style.display = "none";
        }
}
<table class="variations" cellspacing="0">
  <tbody>
        <tr>
        <td class="label"><label for="pa_pricing">Pricing</label></td>
        <td class="value">
    <select id="pa_pricing" class="" name="attribute_pa_pricing" data-attribute_name="attribute_pa_pricing" data-show_option_none="yes" onchange= "getSelectValue(this.value);">
      <option value="">Choose an option</option>
      <option value="retail" >Retail</option>
      <option value="stock" id = "stk" >Stock</option>
    </select>                       
          </td>
            </tr>
            <tr>
            <td class="label"><label for="pa_color">Color</label></td>
                        <td class="value">
        <select id="pa_color" class=" " name="attribute_pa_color" data-attribute_name="attribute_pa_color" data-show_option_none="yes">
            <option value=""  >Choose an option</option>
            <option value="aqua"  >Aqua</option>
            <option value="black"  >Black</option>
            <option value="mixed"  >Mixed</option>

        </select>
                <a class="reset_variations" href="#">Clear</a>
            </td>
            </tr>
    </tbody>
</table>
this html code is a small portion from woocommerce shop that im doing right now and it has product attribute one is for price (Retail , Stock ) another is for Color

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

0

try it:

var selected = document.getElementById("stk");
var hidden = document.getElementById("pa_color");
selected.addEventListener('change', _ => {
    if (selected.value == "stock") {
        hidden.style.display = "none";
    }
}
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