首先引入css和js文件
- <link rel="stylesheet" href="<%=basePath%>assets/css/jquery.gritter.min.css" />
- <script src="<%=basePath%>assets/js/jquery.gritter.min.js"></script>
- $.gritter.add({
- title: '提示',
- text: "工号还未填写",
- class_name: 'gritter-info gritter-center gritter-light',
- time:500
- });
eg:
if ($("#UserName").val() == "" || $("#Password").val() == "") {
errorgrit("错误", "请输入用户名和密码");
}
var errorgrit = function (title, text) {
$.gritter.add({
title: title,
text: text,
class_name: 'gritter-error ' + ' gritter-light',
time: '5000',
});