jQuery   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了使用jquery表单插件动画消息大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

我在使用jquery Form Plugin时遇到问题.我有一个表单,我希望在用户提交错误信息时为错误/成功设置动画,或者在输入正确信息时向用户提供成功消息.但是我的问题是双重的.显示在同一页面上的消息只能在firefox中使用我当前使用的jquery.什么会导致这个?

我想在显示时将不同的消息滑入视图,但是现在它们只是弹出视图.如何使其动画或滑入视图?有问题的页面是@L_675_11@

$(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()
}); */ 
最佳答案
尝试这样做,正常的show()/ hide()方法也可以做动画:

$('.message').show("slow");

请参阅jQuery show( speed,[callback] )

医生说:

此外,您正在错误地使用animate().为了使它工作,至少你需要将一些CSS属性作为一组选项传递给它.查看文档:

http://docs.jquery.com/Effects/animate

编辑:这就是我的意思,你使用我的建议:

$('#alert').onsubmit(function() {
    // This will be called before the form is submitted
    $('.message').show("slow");
});

大佬总结

以上是大佬教程为你收集整理的使用jquery表单插件动画消息全部内容,希望文章能够帮你解决使用jquery表单插件动画消息所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。