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

125
Views
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 answers
Answer question

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 Report
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!