我如何获得价值?

时间:2016-10-27 18:59:11

标签: jquery nouislider

我有一张幻灯片,提供span之间的值,但不能使用此值并在php文件中使用。

形式:

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

脚本:

$。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' }));

    });

};

我尝试将span的值复制到输入值,但它不起作用,因为span文本根据用户的选择而变化。

我试着这样:

$(function(){
    var valorcarrof = $('#valorcarro1').html();
    $('#valorcarro').val(valorcarrof);
});

0 个答案:

没有答案