仅当填写相同表单的所有必填字段(TextBox,DropDownList)时,如何才能启用Web表单中的提交按钮?
问题描述:
我该怎么办,我的困惑是在检查哪个控件的事件时,我可以检查是否必须填写所有必填字段????
在这里,我们不会在提交按钮之前由用户填充哪个控件.
请给我建议
how can i do,my confusion is at which control''s event i can check condition that all required fields are filled or not???
here we don''t which control will be filled by user just before submit button.
please give me suggestion
答
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Disable Button</title>
<script src="http://code.jquery.com/jquery-1.11.0.min.js" ></script>
<script type="text/javascript">
(document).ready(function(){ validate();
(document).ready(function (){ validate();
('#txtName,#txtAddress,#txtPhone').change(validate); }); 函数validate(){ 如果(
('#txtName, #txtAddress, #txtPhone').change(validate); }); function validate(){ if (