我使用php来验证用户登录,我想在登录按钮下显示一个弹出窗口/工具提示说"用户名或密码无效",以防止用户/密码无效。
我的php部分是工作的,用echo测试,但我不能使工具提示工作。
我包含了以下导入
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap-tooltip.js"></script>
创建了以下javascript函数
$(document).ready(function() {
function invalid(){
$('#userNameField').tooltip({
'selector': '',
'placement': 'bottom',
'content' : 'bbbbblblblbl'
});
$('#userNameField').tooltip('show');
}
</script>
我的按钮有userNameField id
<form class="navbar-form pull-right" action="" method="post">
<input type="submit" class="btn" id="userNameField" value="Sign in">
</form>
和我的php在我调用无效函数之前停止(我用警告("test")测试了这部分),它正在工作
?>
<!--Code for invalid username/password combo goes here-->
<script type="text/javascript">
invalid();
</script>
<?php
你知道我做错了什么吗?
工具提示没有content
属性,你需要使用title
医生
$('#userNameField').tooltip({
'placement': 'bottom',
'title' : 'bbbbblblblbl'
});
$('#userNameField').tooltip('show');