当验证失败时,我正在尝试对我的输入类型文本施加抖动效果。它提供了抖动效果,但我不知道如何更改方向,距离和时间的默认值。另外,我认为在变量a中存储文本框的值是错误的,请告诉我正确的语法。谢谢。
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(document).ready(function(){
$("#submitBtn").click(function(){
$a = $("#userNameTxt").value;
if ($a != "text")
{
$("#userNameTxt").effect("shake");
}
});
});
</script>
</head>
<body>
<form action="#" >
<input type="text" name="userNameTxt" id="userNameTxt" placeholder="username" />
<br/>
<input type="submit" value="submit" id="submitBtn" />
</form>
</body>
</html>发布于 2013-07-03 14:44:11
像这些选项一样的东西?
$("#button").click(function(){
$(".target").effect( "shake",
{times:4}, 1000 );
});发布于 2013-07-03 14:45:18
这个应该可以了。
$("#userNameTxt").effect('shake', {
times: 10,
duration: 1000,
direction: 'left' // 'right' for right
});https://stackoverflow.com/questions/17441301
复制相似问题