【问题标题】:Updating a field according to text-box change jQuery根据文本框更改jQuery更新字段
【发布时间】:2017-09-28 00:25:47
【问题描述】:

我编写了一个程序来在用户在文本框中输入值时更改字段的值。在我的情况下,两个文本框是高度和宽度。当有人输入高度和宽度时,应显示相关价格。我会把我的代码写在下面。

<div class="form-group">
        <div class="col-sm-9">
          <input type="text" id="height" />
          <input type="text" id="width" />


          <button type="button" id="show">Enter Size</button>
<button type="button" id="hide">Hide</button>

<script> jQuery('height').on('input', function() {
    <?php echo "hello" ?>


});

function()
{
    <input id="post_price" type="hidden" name="price" value="<?=$price['price'];?>">
}
</script>

        </div>
      </div>

我不太确定我的做法。目前没有输出结果。有人可以帮助我吗?为了更有意义,我将附上我的表单的屏幕截图。谢谢!

【问题讨论】:

    标签: jquery event-handling textchanged


    【解决方案1】:

    您可以使用keydownkeypress 事件。 我做了一个小例子here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-10
      相关资源
      最近更新 更多