1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > select下拉框内容改变 input框内容随之改变

select下拉框内容改变 input框内容随之改变

时间:2022-06-07 12:19:31

相关推荐

select下拉框内容改变 input框内容随之改变

机器类型发生改变,将机器类型对应的激活金额赋值给input框

<div class="form-group"> <label class="col-sm-3 control-label">激活金额:</label><div class="col-sm-8"><input name="actAmt" th:field="*{actAmt}" class="form-control" type="text" readonly/></div></div><div class="form-group"><label class="col-sm-3 control-label">机器类型选择:</label><div class="col-sm-8"><select id = "type" name="type" class="form-control m-b"><option value="">所有</option><option th:each="dict : ${productTypes}" th:content="${dict.actAmt}" th:selected="*{proctypeId}==${dict.id}" th:text="${dict.typeName}" th:value="${dict.id}"></option></select></div></div><div class="form-group" hidden><label class="col-sm-3 control-label">机器类型:</label><div class="col-sm-8"><input name="proctypeId" id="proctypeId" class="form-control" type="text"></div></div><script th:inline="javascript">var prefix = ctx + "product/product";$("#form-type-edit").validate({focusCleanup: true});// 获取选中的select,并获取content的值,然后赋值给input框$("#type").change(function () {var actAmt = $(this).find("option:selected").attr("content");$("input[name='actAmt']").val(actAmt);});function submitHandler() {if ($.validate.form()) {$("#proctypeId").val($("#type").val());$("#templateNo").val($("#rateTemp").val());$.operate.save(prefix + "/procTypeChangeSure", $('#form-type-edit').serialize());}}</script>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。