<ul data-role="listview" data-inset="false" data-icon="false" data-divider-theme="b">
<li data-role="list-divider"><h2>Upcoming events <button data-role="none" class="filter" type="submit">
<i class="fa fa-filter"></i>
</button><button onclick="hide()">Hide social</button><button onclick="show()">show social</button><h2></li>
<div class="ui-field-contain sixtynine" data-position-to="window">
<select name="select-custom-19" id="filter-type" multiple="multiple" data-native-menu="false">
<option>Filter events</option>
<option value="1" selected="selected" id="f-1">family</option>
<option value="2" selected="selected" id="f-2">friends</option>
<option value="3" selected="selected" id="f-3">business</option>
<option value="4" selected="selected" id="f-4">social</option>
<option value="5" selected="selected" id="f-5">private</option>
</select>
</div>
<li data-role="list-divider"><h2>Today<h2></li>
// irrelevant
隐藏社交&#34;和#34;显示社交&#34;工作。我希望能够在select中有他们的行为。所以我没有2个按钮(1个显示,1个隐藏),当我选中显示元素时,我有一个选择选项,当未选中时隐藏它。同意其他4个选项。
那我怎么解决这个问题呢?
答案 0 :(得分:0)
您可以使用jquery提供的on('change')
函数:
$('#filter-type').on('change', function (e) {
var optionSelected = $("option:selected", this);
console.log(optionSelected);
var valueSelected = this.value;
....
});