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

172
Vistas
How to if elase function for following?

I need help to create function to enable option disable other remaining options. For suppose id product price is fall between 5000 to 10000 then it allows to choose only option that has 5000 to 10000 and remain will disable and Price in between 10000 to 20000 and it only allow respictive option to choose. Options dom

option filed for user

Price of product

If above price fall between the slab rates mentioned in options inner text then it should enable and remaining disabled.

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

0

When you loop over to generate the dom, check if (price > min && price < max) to determine if to set a disabled on the option.

Or do after with jQuery, which question suggests

const minPrice = 1000
const maxPrice = 10000

$('.product-custom-option option').each(function() {
  const price = Number($(this).attr('price'))
  if (price >= minPrice && price <= maxPrice) {
    $(this).removeAttr('disabled')
  } else {
    $(this).attr('disabled', true)
  }
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<select class="product-custom-option">
  <option price="100">100</option>
  <option price="500">500</option>
  <option price="1000">1000</option>
  <option price="5000">5000</option>
  <option price="10000">10000</option>
  <option price="50000">50000</option>
</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