首页 > 其他分享 >Failed to execute 'setSelectionRange' on 'HTMLInputElement'

Failed to execute 'setSelectionRange' on 'HTMLInputElement'

时间:2023-05-22 13:32:16浏览次数:50  
标签:function execute Failed fn setSelectionRange input 2016 type setCursorPosition



jcubic commented on 7 Jan 2016


When I use number input I've got error in Google Chrome




Uncaught InvalidStateError: Failed to execute 'setSelectionRange' on 'HTMLInputElement': 
The input element's type ('number') does not support selection.





Failed to execute


jcubic commented on 7 Jan 2016



The fix will be something like:




activate: function() {
            if(this.$input.is(':visible')) {
                this.$input.focus();
                var type = this.$input.attr('type');
                if (type && type.match(/^(text|search|password|tel|url)$/i) || !type) {
                    $.fn.editableutils.setCursorPosition(this.$input.get(0), this.$input.val().length);
                }
                if(this.toggleClear) {
                    this.toggleClear();
                }
            }
        },



Failed to execute



 



zorosun commented on 1 Aug 2016



@akakoori you might want to look at this

Pull request

I fixed it by inserting



(function() {
      var original = $.fn.editableutils.setCursorPosition;
      $.fn.editableutils.setCursorPosition = function() {
          try {
              original.apply(this, Array.prototype.slice.call(arguments));
          } catch (e) { /* noop */ }
      };
  })();






当然,你也可以

min= "0"

标签:function,execute,Failed,fn,setSelectionRange,input,2016,type,setCursorPosition
From: https://blog.51cto.com/u_15976398/6323437

相关文章

  • elasticsearch 启动报错 SearchPhaseExecutionException[Failed to execute phase [qu
    Elasticsearch启动报错:[2023-05-19T22:39:32,161][DEBUG][o.e.a.s.TransportSearchAction][X-111.ecs]Allshardsfailedforphase:[query][2020-05-19T22:39:32,162][WARN][r.suppressed][X-111.ecs]path:/.kibana_task_manager/_search,params:{ign......
  • PIP SSL:CERTIFICATE_VERIFY_FAILED
    今天再安装pyserial的时候一直提示这个错误,电脑代理什么的都关掉了还是有这个错误,然后根据网上的说明,添加添加信任主机选项后就成功安装上pyserial了。pip--trusted-hostpypi.tuna.tsinghua.edu.cninstallpyserial......
  • Maven PKIX path building failed 错误提示
    最近公司的项目突然出现了下面的提示。PKIXpathbuildingfailed:sun.security.provider.certpath.SunCertPathBuilderException:unabletofindvalidcertificationpathtorequestedtarget->[Help2]  问题和解决出现上面的提示的问题是因为SSL签名的问题。但是我们......
  • Maven PKIX path building failed 错误提示
    最近公司的项目突然出现了下面的提示。PKIXpathbuildingfailed:sun.security.provider.certpath.SunCertPathBuilderException:unabletofindvalidcertificationpathtorequestedtarget->[Help2]  问题和解决出现上面的提示的问题是因为SSL签名的问题。......
  • nginx出现: [error] open() "/usr/local/nginx/logs/nginx.pid" failed错误
     问题情况登陆服务器之后进到nginx使用./nginx-sreload重新读取配置文件,发现报==nginx:[error]open()“/usr/local/nginx/logs/nginx.pid”failed(2:Nosuchfileordirectory)==错误,进到logs文件发现的确没有nginx.pid文件如下图解决方法执行下列命令/usr......
  • 关于CentOS8出现“Error: Failed to download metadata for repo 'appstream': Cannot
    原因因为centOS8于2021年12月31日停止了源的服务,而现在时间是2023年,所以之前的方法都不行的原因所在(本质是源的问题)。 解决方法 cd/etc/yum.repos.dsed-i's/mirrorlist/#mirrorlist/g'/etc/yumrepos.d/CentOS-*sed-i's|#baseurl=http://mirror.centos.o......
  • 【git】报错解决方案-'pre -commit hook failed (add --no-verify to bypass)'
    git-commit报错: 可以看到这个报错有两点,第一点是因为npm缓存问题,第二点是pre-commit导致的commit报错pre-commit钩子都被存储在Git目录下的hooks子目录中。当你用gitinit初始化一个新版本库时,Git默认会在这个目录中放置一些示例脚本。这些脚本除了本身可以被......
  • 问题记录之mysql:Job for mysqld.service failed because the control process exited
    今天服务器连接mysql发现一直超时(查出的原因是磁盘满了)清了磁盘以后,mysqld.service 还是无法启动执行命令及报错如下:(注意,因为磁盘满的问题,我的mysql并不是正常途径关闭的)控制进程以错误代码退出导致无法以正常的方式启动它了,错误说明:Jobformysqld.servicefailedbecauset......
  • Secure Connection Failed 安全连接失败无效的证书解决
    SecureConnectionFailed安全连接失败无效的证书解决删除配置文件即可 点击菜单帮助 选择更多故障排除信息 找到配置文件 把浏览器关闭打开配置删除 cert9.db即可   添加例外即可进入 ......
  • Python_报错:curl: (7) Failed to connect to raw.githubusercontent.com port 443: Op
    解决:https://blog.csdn.net/Jimmmyking/article/details/126105788作为mac的用户,如果你还没安装Homebrew那真的就太遗憾了,应为其真的很好用,然后安装Homebrew有时候有不是那么简单,会出现很多奇奇怪怪的错误,如下是我本人第一次安装就成功,其重要用的是中科大的brew主体,使用这个只需......