select2取值报错,Failed to read the 'selectionDirection' property from 'HTMLInputElement': The input element's type ('hidden') does not support selection.
用到了 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.的更多相关文章
- vue引入fastclick设置输入框type="number"报错Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('number') does not support selection.的解决办法
将输入框type设为text,通过正则验证输入的值
- 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 ...
- 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 解决办法: 把上面的代码改成如下问题就解决了
- redis取值报错
> get "all_couriers_on_the_job" (error) ERR Operation against a key holding the wrong k ...
- angularjs Failed to read the 'selectionStart' property from 'HTMLInputElement':
在找angularjs input(type='number')在获取焦点的时候,文本框内容选中效果,参考了:Select text on input focus,我直接复制他的code之后,在ion ...
- angularjs 1 Failed to read the 'selectionStart' property from 'HTMLInputElement':
在找angularjs input(type='number')在获取焦点的时候,文本框内容选中效果,参考了:Select text on input focus,我直接复制他的code之后,在ion ...
- 使用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 ...
- docker拉取镜像报错:net/http: TLS handshake timeout.
docker拉取镜像报错:net/http: TLS handshake timeout. 启动一个后台的busybox容器 [yunva@node1 network-scripts]$ docker ...
- Vue.js报错Failed to resolve filter问题原因
Vue.js报错Failed to resolve filter问题原因 金刚 vue Vue.js js javascript 之前使用vue.js写分页功能时,写了一个过滤器,发现一个比较奇怪的错 ...
随机推荐
- Spring RMI Example
一: 提供服务的远程一端 1-1. applicationContext.xml <?xml version="1.0" encoding="UTF-8" ...
- JSON的三种解析方式
一.什么是JSON? JSON是一种取代XML的数据结构,和xml相比,它更小巧但描述能力却不差,由于它的小巧所以网络传输数据将减少更多流量从而加快速度. JSON就是一串字符串 只不过元素会使用特定 ...
- [.NET] SQL数据总笔数查询
[.NET] SQL数据总笔数查询 程序下载 范例下载:点此下载 原始码下载:点此下载 NuGet封装:点此下载 数据查询 开发系统时,使用C#执行SQL查询指令,就可以从SQL数据库里查询所需数据. ...
- RHEL7文件管理
Linux系统目录结构 主要目录说明 目录 说明 / 通常称为根分区所有的文件和目录的起始点只有root用户对此目录拥有写权限 /home 普通用户的宿主目录 /root 超级用户的宿主目录 /dev ...
- 用Path来绘制一些图形
Path是android中用来封装几何学路径的一个类,因为Path在图形绘制上占的比重还是相当大的.你可以用它来绘制各种样式的几何图形,做图表什么的都可以. 一.画线段 1.1 lineT(float ...
- DDMS无法查看data/data目录?
今天andorid 学习用真机来尝试用Android SQLite数据库时,从DDMS的FileExplore查看数据库文件时会发现里面是空的什么也没有,之前用的一直都是模拟器,现如今用真机 捣鼓了小 ...
- OC知识梳理-NSArray与NSMutableArray相关知识
知识普及: 1.数组中的元素在系统中都会有其默认对应的下标,下标是一个整形的数字,默认从0开始. 例:NSArray *arr3 = @["345","234" ...
- Android源码分析之HandlerThread
HandlerThread是一种特殊的Thread,也就是有Looper的thread,既然有looper的话,那我们就可以用此looper来 创建一个Handler,从而实现和它的交互,比如你可以通 ...
- IOS开发之功能模块--自定义导航控制器类常用自定义的代码
前言:本文篇幅不多,但是涉及到的内容却是开发中常用的. 涉及的内容: 1.统一设置导航控制器子控制器的返回按钮. 2.因为修改了系统的返回按钮,所以还需要设置手势事件. 3.隐藏底部的工具条. 这里直 ...
- unity学习网站汇总
由于最近要学习unity3d 开发,把自己找来的资料汇总下 unity3D官方学习资源:https://www.assetstore.unity3d.com/ unity3D API查询网站:http ...