【发布时间】:2009-06-23 15:24:45
【问题描述】:
我在使用 jquery 表单插件时遇到问题。我有一个设置的表单,我想在用户提交错误信息时为错误/成功设置动画,或者在输入正确信息时为用户提供成功消息。但是我的问题是双重的。显示在同一页面上的消息仅适用于我当前使用的 jquery 在 Firefox 中。什么会导致这个?
我希望不同的消息在显示时滑入视图,但现在它们只是弹出视图。我如何使它具有动画效果或更确切地说是滑入视野?有问题的页面是here
$(document).ready(function() {
var options = {
target: '#alert',
};
$('#myForm').ajaxForm(options);
});
$.fn.clearForm = function() {
return this.each(function() {
var type = this.type, tag = this.tagName.toLowerCase();
if (tag == 'form')
return $(':input',this).clearForm();
if (type == 'text' || type == 'password' || tag == 'textarea')
this.value = '';
else if (type == 'checkbox' || type == 'radio')
this.checked = false;
else if (tag == 'select')
this.selectedIndex = -1;
});
};
/*this is my addition to getting the slide into view, but does not work */
$('#alert').onsubmit(function() {
// This will be called before the form is submitted
$('.message').show().animate("slow");
});
/*$(function() {
$('.message').('slow').show('slow');
$('.message').('slow').show('slow').animate({opacit:1.0}, 4000).hide('slow');
$('input').clearForm()
}); */
【问题讨论】:
标签: jquery animation validation