• 解决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、火狐均兼容效果图如下:

  • 相关阅读:
    linux 共享内存 信号量 同步
    进程间通信 共享内存
    linux 多进程绑定问题
    C 语言调用python 脚本函数
    C 语言 和 python 调用 .so 文件
    好好学习
    three.js
    AMD、CMD、UMD 模块的写法
    webpack查缺补漏
    什么是 Web 服务器(server)
  • 原文地址:https://www.cnblogs.com/bgyb/p/12204807.html
Copyright © 2020-2023  润新知