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

334
Vistas
Changing values when a button is pressed, [multiple choices]

I have the following code inside a POST form. When someone clicks on the input the value of pricing changes to the one the user has clicked.

The input class is just a method of altering the CSS once clicked - so you can see which was clicked last.

(function() {
  $(function() {
    var toggle;
    return toggle = new Toggle('.toggle');
  });

  this.Toggle = (function() {
    class Toggle {
      constructor(toggleClass) {
        this.el = $(toggleClass);
        this.tabs = this.el.find(".hs_pricing_toggle");
        this.panels = this.el.find(".panel");
        this.bind();
      }

      show(index) {
        var activePanel, activeTab;
        //update tabs
        this.tabs.removeClass('activate');
        activeTab = this.tabs.get(index);
        $(activeTab).addClass('activate');
        //update panels
        this.panels.hide();
        activePanel = this.panels.get(index);
        return $(activePanel).show();
      }

      bind() {
        return this.tabs.unbind('click').bind('click', (e) => {
          return this.show($(e.currentTarget).index());
        });
      }

    };

    Toggle.prototype.el = null;

    Toggle.prototype.tabs = null;

    Toggle.prototype.panels = null;

    return Toggle;

  }).call(this);

}).call(this);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="hs_pricing_toggle__wrapper" id="toggle__wrapper">
  <input class="price1 hs_pricing_toggle" type="" id="pricing" name="pricing" placeholder="5" value="5" required/>
  <input class="price2 hs_pricing_toggle" type="" id="pricing" name="pricing" placeholder="10" value="5" required/>
  <input class="price3 hs_pricing_toggle" type="" id="pricing" name="pricing" placeholder="15" value="5" required/>
  <input class="price4 hs_pricing_toggle" type="" id="pricing" name="pricing" placeholder="insert value" required/>

This just changes the CSS of the class 'hs_pricing_toggle' and shows a within the class pannel. Nothing important in this case - I guess.

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