select 移除某一 option 的 javascript 公司用的代码是

var ddlPrimaryResource = document.getElementById(ddlPrimaryResourceID);
ddlPrimaryResource.options[ddlPrimaryResource.selectedIndex].remove();

这段代码在 chrome 里执行OK ,但是在 safari 里却报错了

TypeError: 'undefined' is not a function (evaluating 'ddlPrimaryResource.options[ddlPrimaryResource.selectedIndex].remove()')

google 了一下改成

var ddlPrimaryResource = document.getElementById(ddlPrimaryResourceID);
ddlPrimaryResource.removeChild(ddlPrimaryResource.options[ddlPrimaryResource.selectedIndex]);

引用:http://www.dyn-web.com/tutorials/forms/select/option/

google 访问不了的可以用这个地址:https://s3-us-west-1.amazonaws.com/google3/index.html

select remove option safari 兼容的更多相关文章

  1. js 操作select和option

    js 操作select和option 1.动态创建select function createSelect(){ var mySelect = document.createElement_x(&qu ...

  2. JQuery中对Select的option项的添加、删除、取值

    jQuery获取Select选择的Text和Value: $("#select_id").change(function(){//code...}); //为Select添加事件, ...

  3. jQuery获取Radio选择的Value值||两个select之间option的互相添加操作(jquery实现)

    jQuery获取Radio选择的Value值: 1. $("input[name='radio_name'][checked]").val();  //选择被选中Radio的Val ...

  4. jquery操作select下拉框的各种方法,获取选中项的值或文本,根据指定的值或文本选中select的option项等

    简介jquery里对select进行各种操作的方法,如联动.取值.根据值或文本来选中指定的select下拉框指定的option选项,读取select选中项的值和文本等. 这一章,站长总结一下jquer ...

  5. #Java Web累积#JS动态加载所有同name的select的option

      项目需求: 某一页面,页面使用多列table,每个table中有同相同的<select>,select的option不确定,根据Server端的配置来,所以option需要动态加载: ...

  6. AngularJS下拉列表select在option动态变化之后多出了一个错误项的问题

    场景: Select初始化之后,选中select的某个选项 通过AngularJS更新select的选项 错误写法: HTML(使用ng-repeat) <div ng-app="Te ...

  7. HTML 表单和输入<textarea><label><fieldset><legend><select><optgroup><option><button>

    textarea><label><fieldset><legend><select><optgroup><option>& ...

  8. 有关attribute和property,以及各自对select中option的影响

    这个问题老生常谈,但是直到现在我依旧时常会把它搞混.下面列一些各自的特性.   attribute property 设置方法 option.setAttribute('selected', true ...

  9. JS实现选择不同select标签option值的验证

    js实现不同select标签option值的验证 功能描述: 选择中文时,匹配中文的正则表达式,选择英文选项是匹配英文的表达式,并且有对应的提示信息. html代码片段: <select id= ...

  10. jquery动态刷新select的值,后台传过来List<T>,前台解析后填充到select的option中

    jquery动态刷新select的值:将后台传来的List<T>赋值到select下的option. 第一个select选择后出发该方法refreshMerchant(params),传递 ...

随机推荐

  1. 4. Lighting 窗口

    Lighting 实现烘焙或者实时渲染都在这里设置,其他灯光或者反射探头的作用相当于允许 Lighting (窗口)烘焙或者实时渲染. 0bject: Lightmap Static: 把烘焙的对象设 ...

  2. 【MySQL】导出到CSV

    http://www.yiidian.com/mysql/mysql-export-table-to-cvs.html 要将表导出为 CSV 文件,我们将使用SELECT INTO....OUTFIL ...

  3. TensorFlow中使用tf.keras.callbacks.EarlyStopping防止训练过拟合

    TensorFlow tf.keras.callbacks.EarlyStopping 当模型训练次数epoch设置到100甚至更大时,如果模型的效果没有进一步提升,那么训练可以提前停止,继续训练很可 ...

  4. react 03 组件传值

    一 基础 props: 父传子  单向 import React from 'react'; import ReactDOM from 'react-dom'; import './index.css ...

  5. 最全面 think php 实现微信公众号回复编号进行投票,自定义菜单功能

    前期准备工作 https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messag ...

  6. python通过接口执行shell命令

    需求:通过网站url方式直接执行服务器的shell命令 实现: 1.安装依赖 pip3 install falsk 2.python脚本 [root@localhost tmp]# more fals ...

  7. 前端实现电子签名(web、移动端)通用组件(canvas实现)

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. FreeRdp(一):主要数据结构

    /** RDP连接实例 * 这是创建连接后的客户端选项 * 数据结构申请内存调用freerdp_new,释放为freerdp_free */ struct rdp_freerdp { ALIGN64 ...

  9. 如何在win10网络中发现自己?

    第一步:win10共享媒体流的操作步骤: 1.点击右下角网络-网络和Internet设置 2.进入设置界面后点击网络和共享中心 3.在共享中心界面点击媒体流式处理选项 4.点击启用媒体流 5.设置媒体 ...

  10. springMVC学习day02

    了解springMVC 1. 了解官网 1.  首先到spring地址去,然后选择项目下面的任何一个子项目,我选择spring framework https://spring.io/ 2.选择spr ...