Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/421.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript (将显示)。您可以在此处进行测试:。底线是您不应该使用display:none从列表中删除选项。@JonathanSampson,当删除是临时的时,您应该这样做。删除显示:无比重新附加整个列表快得多。Chrome现在在发布版本中支持显示:无。有趣的是,当设_Javascript_Firefox_Coding Style_Google Chrome - Fatal编程技术网

Javascript (将显示)。您可以在此处进行测试:。底线是您不应该使用display:none从列表中删除选项。@JonathanSampson,当删除是临时的时,您应该这样做。删除显示:无比重新附加整个列表快得多。Chrome现在在发布版本中支持显示:无。有趣的是,当设

Javascript (将显示)。您可以在此处进行测试:。底线是您不应该使用display:none从列表中删除选项。@JonathanSampson,当删除是临时的时,您应该这样做。删除显示:无比重新附加整个列表快得多。Chrome现在在发布版本中支持显示:无。有趣的是,当设,javascript,firefox,coding-style,google-chrome,Javascript,Firefox,Coding Style,Google Chrome,(将显示)。您可以在此处进行测试:。底线是您不应该使用display:none从列表中删除选项。@JonathanSampson,当删除是临时的时,您应该这样做。删除显示:无比重新附加整个列表快得多。Chrome现在在发布版本中支持显示:无。有趣的是,当设置为“不显示”时,它不会隐藏。我个人认为它不应该遵循与dom中其他元素不同的规则,即使它是一个浏览器表单元素。IE像往常一样是最后一个,仍然给我们带来不必要的麻烦。$('select option[value=“1”]”)。remove()正在


(将显示)。您可以在此处进行测试:。底线是您不应该使用
display:none
从列表中删除选项。@JonathanSampson,当删除是临时的时,您应该这样做。删除显示:无比重新附加整个列表快得多。Chrome现在在发布版本中支持显示:无。有趣的是,当设置为“不显示”时,它不会隐藏。我个人认为它不应该遵循与dom中其他元素不同的规则,即使它是一个浏览器表单元素。IE像往常一样是最后一个,仍然给我们带来不必要的麻烦。
$('select option[value=“1”]”)。remove()正在工作
<form>
<select>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<input type="button" onclick="document.getElementsByTagName('option')[0].style.display='none'" value="hide option 1">
</form>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
removeIt = function()
{
    var theSelect = document.getElementById("theSelect");
    var theOption = document.getElementById("theOption");
    theSelect.removeChild(theOption);
};
</script>
</head>
<body>
<select id="theSelect">
<option>1</option>
<option id="theOption">2</option>
<option>3</option>
</select>
<input type="button" onclick="removeIt()" value="remove it!"/>
</body>
</html>
document.getElementsByTagName('option')[0].disabled='disabled'
function removeOptionSelected() {
    var ddl = document.getElementById('ddl_DropList');
    var i;
    for (i = ddl.length - 1; i >= 0; i--) {

        ddl.remove(i);
    }
}
function addOptions3() {
    removeOptionSelected();
    var ddl = document.getElementById('ddl_DropList');
    var elOptNew = document.createElement('option');

    elOptNew.text = 'Monthly Top Producer(Project)';
    elOptNew.value = 'GCE';
    try {
        ddl.add(elOptNew, null); // standards compliant; doesn't work in IE
    }
    catch (ex) {
        ddl.add(elOptNew); // IE only
    }
    elOptNew = document.createElement('option');
    elOptNew.text = 'Monthly Top Leaders - DD';
    elOptNew.value = 'DRE';
    try {
        ddl.add(elOptNew, null); // standards compliant; doesn't work in IE
    }
    catch (ex) {
        ddl.add(elOptNew); // IE only
    }
    elOptNew = document.createElement('option');
    elOptNew.text = 'Monthly Top Leaders - SDD';
    elOptNew.value = 'DRESDD';
    try {
        ddl.add(elOptNew, null); // standards compliant; doesn't work in IE
    }
    catch (ex) {
        ddl.add(elOptNew); // IE only
    }
    elOptNew = document.createElement('option');
    elOptNew.text = 'Monthly Top Leaders - GD';
    elOptNew.value = 'GRE';
    try {
        ddl.add(elOptNew, null); // standards compliant; doesn't work in IE
    }
    catch (ex) {
        ddl.add(elOptNew); // IE only
    }
}
$('form table tr').eq(1).remove();
$('form table tr')
eq(1)
remove()
$('select option[value="1"]').remove();
$('form[name="date"] selection[name="day"] option[value="1"]').remove();
$('form#date selection#day option[value="1"]').remove();
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Demo Page</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
        <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
        <script>

            function sourceListChange() {
                var oVisible = $('#destList');
                var newCategory = $( "#sourceList" ).val()||'';
                var oToShow = $();

                oHiddenDestList.append(oVisible.find('option'));

                if (newCategory) {
                    oToShow = oHiddenDestList.find('.'+newCategory);
                }           

                if (oToShow.length==0) {
                    oVisible.append (oHiddenDestList.find('.NA'));
                } else if (oToShow.length!=1) {
                    oVisible.append (oHiddenDestList.find('.SELECT'));
                }
                oVisible.prop('selectedIndex', 0);

                oVisible.append (oToShow);
            }

            $(document).ready(function() {
                sourceListChange();
            });

            var oHiddenDestList = $(document.createElement('select'));

        </script>
        <style>

        </style>
    </head>

    <body>

        Select a parent group:
        <select id="sourceList" onchange="sourceListChange()">
            <option class="SELECT" value="" selected disabled>Please Select</option>
            <option value="veg">Vegetables</option>
            <option value="fruit">Fruit</option>
        </select>

        <select id="destList">
            <option class="SELECT" value="*" selected disabled>Please Select</option>
            <option class="NA" value="" selected disabled>Not Applicable</option>
            <option class="fruit">Apple</option>
            <option class="fruit">Bannana</option>
            <option class="veg">Carrot</option>
            <option class="veg">Pea</option>
        </select>       
    </body>
</html>
var ua = navigator.userAgent.toLowerCase();

var check = function(r) { return r.test(ua);};

var isChrome = check(/chrome/);
`
var f=document.getElementById('select_tag_id');

f.options[i].style.display='none';

if (isChrome) f.size=2;