$(document).ready(function() {
Orientation();
$("#to_check_recognition").change(function() {
Orientation();
});
});
function Orientation() {
if ($("#to_check_recognition").val() == 'yes')
$("#Average_orientation").show();
else
$("#Average_orientation").hide();
}
<title> Cycle Time Calculation INSIGNUM</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<form action="form_table_output.html" name="myform" method="post" onsubmit="return ValidateForm(this);" style="width: 1200px; margin:0px auto">
<h1 title="Cycle calculation"> Cycle Time Calculation INSIGNUM </h1>
<hr><br>
<p>Cycletime calcualation of module siyes between 5mil and 15mil</p>
<table border="0" cellpadding="18" cellspacing="10" style="margin:0px 40px;">
<tr>
<td style="width: 50%">
<label for="to_check_recognition"><b>Do you have to check Orientation? <span style="color:red">*</span></b></label><br><br>
<select id="to_check_recognition" name="to_check_recognition" style="width: 350px; height: 35px; border-radius: 8px" required>
<option value="" disabled selected> Please Select... </option>
<option value="yes"> Yes</option>
<option value="no"> No </option>
</select><br><br>
</td>
<td style="width: 50%">
<div id="Average_orientation" style="display: none;">
<label for="Average_orientation"><b>Average amount of orientation check per panel <span style="color:red">*</span></b></label><br><br>
<input type="number" step="any" name="Average_orientation" style="width: 350px; height: 25px; border-radius: 8px" required /><br><br>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: right; height: 225px">
<input name="submit" type="submit" value="Click To Submit" style="width: 200px; height: 50px; border-radius: 12px; color: blue; background: gold; cursor: pointer;" />
</td>
</tr>
</table>
</form>
这个问题是因为,尽管字段是隐藏的,但它仍然具有required
属性。因此,表格不能提交。要解决这个问题,您需要在字段显示/隐藏时添加/删除该属性。
还要注意,您的JS代码不应该随意地放在table
元素的中间。可以将其放在中,也可以放在
之前。
最后,不要使用内联事件属性,如onclick
和onsubmit
。改用不引人注目的事件处理程序。同样,不要将CSS内联到HTML中。它应该从一个单独的样式表应用。
$(document).ready(function() {
Orientation();
$("#to_check_recognition").change(function() {
Orientation();
});
$('form').on('submit', function(e) {
console.log('form submitting...');
if (!ValidateForm(this)) {
e.preventDefault();
}
});
});
function Orientation() {
var averageReqd = $("#to_check_recognition").val() === 'yes';
$("#Average_orientation").toggle(averageReqd);
$('input[name="Average_orientation"]').prop('required', averageReqd);
}
function ValidateForm() {
// noop
}
form {
width: 1200px;
margin: 0px auto;
}
table {
margin: 0px 40px;
}
table td {
width: 50%;
}
#to_check_recognition {
width: 350px;
height: 35px;
border-radius: 8px;
}
#Average_orientation {
display: none;
}
span,
span {
color: red;
}
#Average_orientation input {
width: 350px;
height: 25px;
border-radius: 8px;
}
td.foo {
text-align: right;
height: 225px;
}
td.foo input {
width: 200px;
height: 50px;
border-radius: 12px;
color: blue;
background: gold;
cursor: pointer;
}
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<form action="form_table_output.html" name="myform" method="post">
<h1 title="Cycle calculation"> Cycle Time Calculation INSIGNUM </h1>
<hr><br>
<p>Cycletime calcualation of module siyes between 5mil and 15mil</p>
<table border="0" cellpadding="18" cellspacing="10">
<tr>
<td>
<label for="to_check_recognition">
<b>
Do you have to check Orientation?
<span>*</span>
</b>
</label><br><br>
<select id="to_check_recognition" name="to_check_recognition" required>
<option value="" disabled selected>Please Select...</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select><br><br>
</td>
<td>
<div id="Average_orientation">
<label for="Average_orientation">
<b>
Average amount of orientation check per panel
<span>*</span>
</b>
</label><br><br>
<input type="number" step="any" name="Average_orientation" required /><br><br>
</div>
</td>
</tr>
<tr>
<td colspan="2" class="foo">
<button type="submit">Click To Submit</button>
</td>
</tr>
</table>
</form>
''处理命令时发生未知的服务器端错误。原始错误:执行adbExec时出错。原始错误:“命令”D:\program\android sdk\platform tools\adb。exe-P 5037-s f8cb3e08安装-g E:\appium\resources\app\node_modules\appium\node_modules\io。阿皮姆。设置\apks\settings\u apk
我试图保存表单数据到mysql数据库的最后2天,但是,表单数据没有保存到mysql数据库,而是下载用户我nfo.php代码文件到我的计算机每次我按提交按钮。需要援助!这是html表单; 这是php代码db.php; 用户Info.php
我正在使用java和mysql,但我无法修复错误。当我将new Farm插入表时,我正面临这些错误...... Java语言sql。SQLException:当autocommit=true时无法调用commit 错误如下 Java语言sql。SQLException:当autocommit=true时无法调用commit _commandsSQLE_loopSQLException(SQLEpa
本文向大家介绍javascript实现避免页面按钮重复提交,包括了javascript实现避免页面按钮重复提交的使用技巧和注意事项,需要的朋友参考一下 绑定事件即可调用 以上就是本文的全部内容了,小伙伴们拿到自己项目中测试下吧。
这是我的密码 新闻.java NewsRepository.java 新闻ervice.java NewsServiceImpl.java NewsController.java 新闻ApiController.java templates.admin.news.create templates.admin.news.index 当我点击链接去templates.admin.news.index,
嗨,我的问题是我不能添加按钮到动作听者,我会做一个菜单,我不知道为什么我成为一个错误在这里代码包lvl; }哦,我变成了一个错误,错误说不能在静态上下文中使用它,它是由credits.addActionListener(this)创建的;请帮助我