0

In my application we have many drop down lists. I want to read only those drop down list that has a selected value. I am able to get these values by the following code. But the following code returns the first value of the dropdownlist which is "Select One" also. I don't want this value. Is there any way can I get rid of this value.

Here is my code.

@@@@@@@@@@

<div>
    <ul class="nav nav-tabs nav-stacked" data-bind="foreach:fileHeaders">
        <li><div>               
                <select data-bind="options:$parent.parentDDL, optionsText: 'text', optionsValue: 'id',value : parentTypeName, optionsCaption: 'Select Type...'"></select>
               <span class="childselect" data-bind="visible:showChildDDL"><select id="selChildDDL" data-bind="options:childDDL,  value: childSelect" ></select></span> 
            </div>
        </li>
    </ul>
</div>


self.saveImportClicked = function (temp) {

     var ids2 = $(".selChildDDL > option:selected")
                  .map(function (n, i) { return ($(i)[0].innerHTML); })
                  .toArray().join(",");
};
4

1 回答 1

1

Try

var ids2 = $(".selChildDDL > option:selected").not(':first-child').map(function (n, i) { return ($(i)[0].innerHTML);  }).toArray().join(",");

to return value

var ids2 = $(".selChildDDL > option:selected").not(':first-child').map(function (n, i) { return $(this).val();  }).toArray().join(",");
于 2013-08-21T03:54:02.953 回答