使用onChange事件清除div中多个所选项目的内容

时间:2016-02-01 12:48:59

标签: javascript jquery html dom

一旦我点击带有onChange事件的选择按钮,我就需要清除div的多个选定项目。

<div ng-show="currentDetails.type=='product_available_in_order'">
        <label> Product Filters : </label>
            <div style="padding-left: 10px;">
                <label>Products Group</label>
                <br/>

                <select ng-model="currentDetails.settings.product_filters.group" onChange="clrContentInabc ()">
                    <option value="products">Products</option>
                    <option value="categories">Specific Categories</option>
                                    <option value="collections">Specific Collections</option>
                            </select>


                            <label>Select {{currentDetails.settings.product_filters.group}}</label>

                            <div ng-show="currentDetails.settings.product_filters.group" id="abc">

                            <select ng-model="currentDetails.settings.product_filters[currentDetails.settings.product_filters.group]"
                                              id="e2" multiple="multiple"
                                              style="width: 100%;"
                                              ng-options="option.alias as option.name for option in ComplimentData[currentDetails.settings.product_filters.group]">
                            </select>

                </div>

                     </div>

                <script type="text/javascript">
                 function clrContentInabc(){

                        WHAT TO DO HERE???

                 }

                </script>

</div>

div&#34; abc&#34;必须设置为默认值,即空白。我已经使用了empty()函数但是它导致没有加载select的选项。我也试过.val(&#34;&#34;)或innerHTML,html(&#34;&#34;)并且它们都导致没有加载div&#34; abc&#34;

0 个答案:

没有答案