目测应该是克隆混乱造成的。像这种省市县级联动,应该用不着克隆。清空下拉再赋值html或者options.add()即可。

解决方案 »

  1.   

    try    $("#provinceOid").change(function () {
            $("#distOid").empty();
            $("#cityOid").empty();
            //opt.clone().attr("value", "").html("-" + $("#selectSp").html() + "-").appendTo("#distOid");
            //opt.clone().attr("value", "").html("-" + $("#selectSp").html() + "-").appendTo("#cityOid");
            $('#distOid,#cityOid').append('<option value="">-' + $("#selectSp").html() + '-</option>');
            var parId = $(this).val();
            if (parId != "") {
                $.ajax({
                    type: "GET",
                    url: "<c:url value='/obtaionListDistrictsByParentOidByJson.action'/>",
                    async: false,
                    data: {
                        paramDistParentOid: parId
                    },
                    dataType: "json",
                    success: function (data) {
                        var dists = data.dists;
                        if (dists != null) {
                            $.each(dists, function (index, value) {
                                $('#distOid').append('<option value="' + value.entityOid + '">-' + value.distName + '-</option>');
                            });                    }
                    }
                });
            }
        });
      

  2.   

    我clone的只是"<option></option>",不是携带数据的
    js里面的清空等操作是已经执行过了 我已经测试过了 是已经走通了 并且在F12工具下已经显示正确 BUG就是页面上竟然显示不正确 很头疼
      

  3.   

    纯dom操作试试,不行就是你们浏览器的bug了。。   $("#provinceOid").change(function () {
            var distOid = $("#distOid")[0];
            var cityOid = $("#cityOid")[0];
            distOid.options.length = 0;
            cityOid.options.length = 0;
            distOid.options.add(new Option("-" + $("#selectSp").html() + "-", ''));
            cityOid.options.add(new Option("-" + $("#selectSp").html() + "-", ''));
            var parId = $(this).val();
            if (parId != "") {
                $.ajax({
                    type: "GET",
                    url: "<c:url value='/obtaionListDistrictsByParentOidByJson.action'/>",
                    async: false,
                    data: {
                        paramDistParentOid: parId
                    },
                    dataType: "json",
                    success: function (data) {
                        var dists = data.dists;
                        if (dists != null) {
                            $.each(dists, function (index, value) {
                                distOid.options.add(new Option(value.distName, value.entityOid));
                            });                    }
                    }
                });
            }
        });
      

  4.   


    解决了。。是因为我的3个select是用js生成的 我后来改成页面写死就可以了 具体原因也不清楚