几秒后隐藏div [英] Hiding the div after few seconds

查看:62
本文介绍了几秒后隐藏div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



如果文本框为空,我必须在div中显示错误消息。

但是之后同一时间5秒我隐藏了相同的错误消息div。

任何人都可以帮助我。



 $( ' #button')。click(function(){

var txt = $( #txt_box1) .val();
如果(txt == ){
$( #txt)。 css({' border'' 1px solid#f2d3ce'});
// div ID error_msg
$( #error_msg)。show (慢);
hidemeplease();
}
});

函数hidemeplease(){
// 如何编写隐藏代码5秒后的div。
}

解决方案

' #button')。点击(function(){

var txt =


#txt_box1)。 val();
if (txt == ){


#txt)。css({' border' ' 1px solid#f2d3ce'});
// div ID error_msg

Dear Friends,

I have to display a error message in a div if the textbox is empty.
But same time after 5 sec. I have hide the same error message div.
Can any one help me out.

$('#button').click(function () {

var txt= $("#txt_box1").val();
    if (txt== "") {
       $("#txt").css({ 'border': '1px solid #f2d3ce' });
//div ID error_msg
       $("#error_msg").show(slow);
            hidemeplease();
      }
});

function hidemeplease(){
//how to write the code for hiding the div after 5sec.
}

解决方案

('#button').click(function () { var txt=


("#txt_box1").val(); if (txt== "") {


("#txt").css({ 'border': '1px solid #f2d3ce' }); //div ID error_msg


这篇关于几秒后隐藏div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆