我想在提交按钮被按下并且一切都成功完成后显示一个提醒。我现在用的是如何在Bootstrap中发生事件后显示警报?
jqBootstrapValidation.js
库,以验证形式不被不值发送。这是我现在所拥有的代码:
<!DOCTYPE html>
<br/>
<html lang="en">
<head>
<title>Title</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
</head>
<body>
<form class="form-horizontal">
<div class="control-group">
<label class="control-label">Email address</label>
<div class="controls">
<input type="email" required />
<p class="help-block"></p>
</div>
</div>
<div class="control-group">
<label class="control-label">Type something</label>
<div class="controls">
<input type="text" name="some_field" required />
<p class="help-block"></p>
</div>
</div>
<input type="submit" value="submit"/>
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <!-- or use local jquery -->
<script src="/js/jqBootstrapValidation.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<script>
$(function() {
$("input,select,textarea").not("[type=submit]").jqBootstrapValidation();
});
</script>
<div class="container">
<h2>Alerts</h2>
<p>Form Successful</p>
<div class="alert alert-success fade in">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong>Success!</strong> You have filled in the form correctly!
</div>
</div>
</body>
</html>
我想在此之后出现在顶部左上角,然后重定向我到另一个网页2秒后左右(目前到同一页)验证成功。这可能吗?
<div class="container">
<h2>Alerts</h2>
<p>Form Successful</p>
<div class="alert alert-success fade in">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong>Success!</strong> You have filled in the form correctly!
</div>
</div>
我不知道,但我相信,验证功能必须返回AV ALUE。你能检查它吗? – Rajesh