在手柄中选择选项时自动填充其他字段

时间:2018-05-23 17:49:28

标签: javascript handlebars.js

我有一个看起来像这样的模态,每当我从文章列表中选择产品时,我想自动填写价格输入值。我该如何实现这一目标?谢谢

<div class="modal-body">

            <div>
                <label for="type">article</label>
                <select id="article" name="article" class="form-control">
                    {{#each articles}}
                    <option>{{name}}</option>
                    {{/each}}
                </select>

            </div>
            <input type="text" class="form-control" name="desc" id="desc" placeholder="Description" value="{{desc}}">
            <input type="text" class="form-control" name="quantity" id="quantity" placeholder="Qté commandée" value="{{quantity}}">
            <input type="text" class="form-control" name="price" id="price" placeholder="Prix Unitaire" value="{{price}}">
            <input type="text" class="form-control" name="tax" id="tax" placeholder="Taxes" value="{{tax}}">
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Quité</button>
            <button type="button" name="add" id="add" onclick="isValid()" class="btn btn-primary" data-dismiss="modal">Ajouter</button>
        </div>

任何帮助??

1 个答案:

答案 0 :(得分:1)

我没有测试它,但这样的东西..?

O (n log log n)