我正在尝试使用jQuery来格式化所需的字段错误。当表单在文本框中没有值的情况下提交时,它应该阻止表单的提交,并且应该显示与以下内容相对应的样式。
·ui-助手-重置
·用户界面-助手-清除程序
·用户界面-状态-错误-文本
·ui-图标-警报
,什么是最好的方法?
注意:代码对应于ASP.NET (form runat="server")
守则:
<html lang="en">
<head>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.6/jquery-ui.js"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.13/themes/flick/jquery-ui.css"
rel="stylesheet" type="text/css" />
<title>Interaction cues</title>
</head>
<body>
<%-- ui-helper-reset, ui-helper-clearfix, ui-state-error-text, ui-icon-alert--%>
<form runat="server" >
<div>
<a> User Name </a>
<input id="Text1" type="text" />
<span> * </span>
<a>Required field</a>
</div>
<input id="Button1" type="button" value="button" />
</form>
</body>
</html>发布于 2012-03-18 13:51:13
https://stackoverflow.com/questions/9273049
复制相似问题