【问题标题】:Join 2 input Jquery?加入2输入Jquery?
【发布时间】:2015-07-31 03:54:16
【问题描述】:

我有基本的 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 的值。单击输入单选时如何从输入数字显示中获取值?

【问题讨论】:

标签: javascript jquery html


【解决方案1】:

从输入中删除data-value,你可以很容易地得到它,如下所示:

DEMO

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

【讨论】:

  • 感谢 Guruprasad Rao,但如果我有 1 个输入收音机(不包括输入号码),喜欢链接 designquote.net/html/dq_estimate_wizard.cfm,主题“复制”。那么如何获取价值呢?
  • 不清楚!!我在您提供的链接中看到了,它与您在此处提供的选项相同!!请您详细说明一下!!
猜你喜欢
  • 1970-01-01
  • 2021-12-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-10-16
  • 1970-01-01
相关资源
最近更新 更多