用到了 select2 组件来多选收件人,用搜狗浏览器(6.2版高速模式)在执行到如下这句时报错(Uncaught InvalidStateError: Failed to read the 'selectionDirection' property from 'HTMLInputElement': The input element's type ('hidden') does not support selection.),6.3版高速和兼容模式都没问题。

var recipients = JSON.stringify($("select#recipient").select2('data'));

咋一看好像是 input[hidden] 不支持 selection,搞不明白,还是先上 stackoverflow,居然有人遇到同样的问题

http://stackoverflow.com/questions/25487927/javascript-stringify-object

解决办法:

//var recipients = JSON.stringify($("select#recipient").select2('data')); //搜狗6.2.5.21637高速模式下报错
var selectedObjects = $("select#recipient").select2('data');
var dataToSave = [];
$.each(selectedObjects, function (index, obj) {
  dataToSave.push({ "id": obj.id, "text": obj.text });
});
var recipients = JSON.stringify(dataToSave);

select2取值报错,Failed to read the 'selectionDirection' property from 'HTMLInputElement': The input element's type ('hidden') does not support selection.的更多相关文章

  1. vue引入fastclick设置输入框type="number"报错Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('number') does not support selection.的解决办法

    将输入框type设为text,通过正则验证输入的值

  2. Uncaught InvalidStateError: Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string.

    使用 HTML5 的图片上传api的时候报如下错误: Uncaught InvalidStateError: Failed to set the 'value' property on 'HTMLIn ...

  3. Uncaught DOMException: Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string.

    今天上传图片遇到这个报错 百度了下,网上说是input标签type=file所以导致的问题,可是我的type=hidden 解决办法: 把上面的代码改成如下问题就解决了

  4. redis取值报错

    > get "all_couriers_on_the_job" (error) ERR Operation against a key holding the wrong k ...

  5. angularjs Failed to read the 'selectionStart' property from 'HTMLInputElement':

    在找angularjs input(type='number')在获取焦点的时候,文本框内容选中效果,参考了:Select text on input focus,我直接复制他的code之后,在ion ...

  6. angularjs 1 Failed to read the 'selectionStart' property from 'HTMLInputElement':

    在找angularjs input(type='number')在获取焦点的时候,文本框内容选中效果,参考了:Select text on input focus,我直接复制他的code之后,在ion ...

  7. 使用laravel-admin后台sdk报错Failed to load resource: net::ERR_CERT_AUTHORITY_INVALID、Provisional headers are shown

    报错Failed to load resource: net::ERR_CERT_AUTHORITY_INVALID请先确定自己的资源url是否可以确实访问到(地址正确与否.访问权限是否开启等) 若n ...

  8. docker拉取镜像报错:net/http: TLS handshake timeout.

    docker拉取镜像报错:net/http: TLS handshake timeout. 启动一个后台的busybox容器 [yunva@node1 network-scripts]$ docker ...

  9. Vue.js报错Failed to resolve filter问题原因

    Vue.js报错Failed to resolve filter问题原因 金刚 vue Vue.js js javascript 之前使用vue.js写分页功能时,写了一个过滤器,发现一个比较奇怪的错 ...

随机推荐

  1. OAuth2.0 基础概述

    web:http://oauth.net/2/ rfc:http://tools.ietf.org/html/rfc6749 doc:http://oauth.net/documentation/ c ...

  2. JPA学习(3)JPA API

    在我们的jpa的helloworld中,我们看到了简单的一个jpa保存操作,下面就来好好学习一下,JPA最主要的几个类 1.基本的几个类: ①:Persistence 类是用于获取 EntityMan ...

  3. SFTP和FTS协议的区别

    都是为FTP连接加密,协议非常相似.一个是借助SSL协议加密,一个时借助SSH协议加密.SSL是为HTTP/SMTP等加密设计的:SSH是为TELNET/FTP等加密.建立传输通道而设计的.其实SSH ...

  4. UML类图相关实践

    最近看了下设计模式,其中无可避免会设计很多类图,UML类图对于学习设计模式很重要,关于设计模式,我也会在这里写上一写,这一篇关于UML类图的就先当个铺垫. 1.先上一个简单的类图来简单说明下: 1). ...

  5. swift学习笔记之-构造过程

    //构造过程 import UIKit /* 构造过程(Initialization): 1.构造过程是使用类.结构体或枚举类型的一个实例的准备过程.在新实例可用前必须执行这个过程,具体操作包括设置实 ...

  6. MSCRM 仪表盘 控件 数量 更改(Change the maximum no. of controls on MSCRM Dashboards )

    The maximum number of controls allowed on MSCRM dashboards are 6. You cannot put the more than 6 gra ...

  7. SharePoint 服务器端对象模型 之 使用LINQ进行数据访问操作(Part 2)

    (四)使用LINQ进行列表查询 在生成实体类之后,就可以利用LINQ的强大查询能力进行SharePoint列表数据的查询了.在传统SharePoint对象模型编程中,需要首先获取网站对象,再进行其他操 ...

  8. GTD桌面2.0

    在以前实践了一个GTD桌面,当时称为1.0版本,当时的效果是这样的: 2015年更换一点设备,把GTD桌面升级一下,就称为2.0吧.直接上图: 可以发现显示器由以前的1台又变回2台,原以为1台大显示器 ...

  9. swift GCD使用指南

    swift GCD使用指南 Grand Central Dispatch(GCD)是异步执行任务的技术之一.一般将应用程序中记述的线程管理用的代码在系统级中实现.开发者只需要定义想执行的任务并追加到适 ...

  10. 嵌入式调试器原理和各类调试器集锦(JLINK、STLINK、CCDEBUG)

    工欲善其事,必先善其器.调试器在嵌入式开发调试中的重要性不言而喻,单步.断点和监察的效率远高于串口打印.但是,调试器对于一般开发人员往往是一个黑匣子.今天我们就来谈谈调试器的原理,顺便把自己的几类调试 ...