0
votes

I have a slide that provides a value between span, but not can take this value and use on a php file.

Form:

<div class="quote-form" data-quote-form-for="consorcio-auto">

  <div class="quote-form-content">

    <h2>Quero um <span>Automóvel</span></h2>

    <div class="form">

      <h4>Valor do consórcio: <span class="slider-value quote-form-element valor-carro1" data-name="Valor | Automóvel" name="Valor" data-slider-id="consorcio-auto">R$ <span></span></span>
                            </h4>
      <div class="slider" id="slider" data-slider-min="20000" data-slider-max="100000" data-slider-start="23192" data-slider-step="1000" data-slider-id="valorcarro1"></div>

      <h4>Seus dados:</h4>
      <input class="formContato" type="hidden" name="valorcarro" id="valorcarro" />
      <input type="text" name="Nome" placeholder="Nome..." class="quote-form-element" />
      <input type="text" name="Cidade" placeholder="Cidade/UF..." class="quote-form-element quote-form-client-email last" />
      <input type="text" name="Telefone" placeholder="Telefone..." class="quote-form-element telefone" />
      <input type="text" name="Email" placeholder="E-mail..." class="quote-form-element quote-form-client-email last contact_email" />

      <button class="button button-navy-blue send-quote" type="submit" id="enviar">Simular meu consórcio <i class="fa fa-paper-plane-o"></i></button>

      <div class="quote-form-thanks">

        <div class="quote-form-thanks-content">         

        </div>

      </div>

    </div>

  </div>

</div>

script:

$.martanianConfigureValueSlider = function () {

    $('#quote-popup .quote-form .slider, section.quote-forms .slider').each(function () {

        var sliderValueMin = $(this).data('slider-min');
        var sliderValueMax = $(this).data('slider-max');
        var sliderValueStart = $(this).data('slider-start');
        var sliderValueStep = $(this).data('slider-step');
        var sliderID = $(this).data('slider-id');

        $(this).noUiSlider({ start: sliderValueStart, step: sliderValueStep, range: { 'min': sliderValueMin, 'max': sliderValueMax } });
        $(this).Link('lower').to($('.slider-value[data-slider-id="' + sliderID + '"] span'), null, wNumb({ thousand: '.', decimals: '0' }));

    });

};

i alrealdy tried copy the value of the span to a input value, but it doesnt work because the span text changes according to the choice of user.

I tried to like this:

$(function(){
    var valorcarrof = $('#valorcarro1').html();
    $('#valorcarro').val(valorcarrof);
});
Try to replace $('#valorcarro').val(valorcarrof); with $('#valorcarro').html(valorcarrof); - lucasnadalutti
This describes how to get the current value of the slider: refreshless.com/nouislider/slider-read-write - Patrick Q