提问人:user6086008 提问时间:11/16/2023 最后编辑:user6086008 更新时间:11/16/2023 访问量:19
在 onclick 函数中将 PUG 中的表单值作为参数传递
pass form value in PUG as a paramater in onclick function
问:
我正在尝试从表单中传递一个值,以用作 onclick 按钮中函数中的参数。但我不确定如何获得价值。
此硬编码示例有效:
button.btn.btn-glider(onclick=helpers.subscribe("[email protected]")) Download
我尝试了以下方法从表单中获取值
button.btn.btn-glider(onclick=helpers.subscribe(('fieldEmail').value)) Download
button.btn.btn-glider(onclick=helpers.subscribe(document.getElementById('fieldEmail').value)) Download
mixin Report
form
.modal#ReportModal
.modal-dialog.modal-dialog-centered.modal-dialog-scrollable(role='document')
.modal-content
.modal-header
.modal-title
button.close(type="button" data-dismiss="modal") ×
.modal-body
div.loading.d-none
.spinner#searchSpinner
.bounce1
.bounce2
.bounce3
div.form
p.highlight.text-center.small Enter your name and email to download
div.mb-3
input.form-control(aria-label="Name" id="fieldName" maxlength="200" name="cm-name" placeholder="Name")
div.mb-3
input.form-control.js-cm-email-input.qa-input-email(autocomplete="Email" aria-label="Email" id="fieldEmail" maxlength="200" name="cm-ydkykyi-ydkykyi" required="" type="email" placeholder="Email")
.modal-footer
button.btn.btn-glider(onclick=helpers.subscribe("[email protected]") Download
这是 IM 调用的函数
function subscribe (email) {
};```
答: 暂无答案
评论