问题描述
我有基本的HTML代码
<div class="w-input-number-change">
<input class="other-select input-number-change" type="radio" data-price="110" data-value="I will supply ___ pages of typed content" name="copy">
I will supply
<input class="other-select input-number-change-value" type="number" data-price="110" data-value="pages of typed content" name="copy" value="1">
pages of typed content.
</div>
我得到值输入型收音机
$content_radio = $('.input-number-change').data('value');
我将选择输入类型单选,显示“我将提供_页的输入内容”,其中_是输入类型number的值。 单击输入单选框时如何从显示的输入数字中获取价值?
1楼
Guruprasad Rao
1
2015-07-31 04:13:14
从输入中删除data-value
,您可以很容易地获得它,如下所示:
的HTML
<div class="w-input-number-change">
<input class="other-select input-number-change" type="radio" data-price="110" name="copy"/>
I will supply
<input class="other-select input-number-change-value" type="number" data-price="110" data-value="pages of typed content" name="copy" value="1"/>
pages of typed content.
</div>
JS
$('.input-number-change').on('click',function(){
var value=$(this).siblings('.input-number-change-value').val();
alert('I will supply '+value +' pages of typed content')
});