zoukankan      html  css  js  c++  java
  • 解决jQuery中input 失去焦点之后,不能再获取到焦点

    //编辑过敏史
            if(iToolbar == 'editGMS'){
                lstype="gms";
                var gms="";
                if(gmstype=="0"){
                    gms=$('#GMSInfo').html();
                    $('#GMSDIV').html('<textarea class="form-control" id="GMSDesc" name="GMSDesc" style="100%; height:80px;" maxlength="500" autofocus="autofocus">'+gms+'</textarea>');
                    gmstype="1";
                    window.setTimeout (function(){ document.getElementById ('GMSDesc'). select();},0 );//自动获取焦点
                }
                
                 $("#GMSDesc").on("blur",function(){//失去焦点事件
                     if(gmstype=="1"){
                            gms=$('#GMSDesc').val();
                        }else{
                            gms=$('#GMSInfo').html();
                        }
                        setTimeout(function(){//延迟执行
                             $.ajax({
                                    type : "POST",
                                    url : '<%=request.getContextPath()%>/Svl_ConsultationManage',
                                    data : 'active=editJBS&iUSERCODE='+pid+'&jbinfo='+gms+'&lstype='+lstype,
                                    dataType:"json",
                                    success : function(data){
                                        gmstype="0";
                                        $('#GMSDIV').html('<span id="GMSInfo" name="GMSInfo">'+gms+'</span>');
                                    }
                                });
                            },150);
                        })  
            }
            

    此方法ie、火狐均兼容效果图如下:

  • 相关阅读:
    WebContent的子目录里面的jsp文件无法将数据传递给Servlet
    MVC 与 三层架构
    使用命令行操作MySQL 及 语法
    JDBC
    字符典
    servlet 生命周期
    6 shell内置命令
    5shell中的数组
    4shell中的特殊变量
    3shell命令替换
  • 原文地址:https://www.cnblogs.com/bgyb/p/12204807.html
Copyright © 2011-2022 走看看