获取价值和文本和div内容javascript

时间:2017-09-11 13:13:51

标签: javascript jquery radio-button

我的按钮中有以下javascript代码

$('#button-confirm').on('click', function() { $.ajax({ type: 'post', url: 'index.php?route=payment/leasing_plans/confirm', cache: false, data:{ egn: $('#input-payment-egn').val(), months: $('input[name=months]:checked').parent().text() }, beforeSend: function() { $('#button-confirm').button('loading'); }, complete: function() { $('#button-confirm').button('reset'); }, success: function() { location = '<?php echo $continue; ?>'; } }); });

我想从这个div中获取数据

<div id="uni18" class="leasecond">
<input type="text" style="border: none; background: repeat;" readonly />Разсрочено плащане с UNI Credit, вноски 18 x обща дължима сума:

以及单选按钮

中的文本和值
<div class="radio">
    <label><input type="radio" name="months" value="uni18"  />18 месеца x </label>
    </div>

怎么能实现呢? 谢谢!

1 个答案:

答案 0 :(得分:1)

我这样做了:

months: $('input[name=months]:checked').parent().text() + $('input[name=months]:checked').val()