我使用jQuery來創建一個列表視圖和過濾器。如果用戶點擊某個項目,我希望過濾器將文本設置爲點擊項目並隱藏列表。但不是永久!如果用戶更改過濾器文本,則需要返回列表。jQuery的ListView的 - 如何隱藏項目被點擊時的列表
以下是我有:
$(document).ready(function() {
jQuery.support.cors = true;
$("#groupSelectList").listview({
filter: true,
filterPlaceholder: '',
icon: false
});
$('#groupSelectList').children('li').on('click', function() {
$('#groupName').val($(this).text());
$("input[data-type='search']").val($(this).text())
//$("#groupSelectList").listview("refresh");//this refresh doesn't appear to do anything.
$("#groupSelectList").listview().hide()//hide works, but the list won't come back if the user changes the input text.
});
});
...
此頁面上的小部件是我使用的控制的一個例子: http://view.jquerymobile.com/master/demos/
我有相同的頁面上有兩個jQuery Mobile的列表視圖和這個$( 「輸入[數據類型= '搜索']」)VAL($。 (this).text()),將值分配給文本搜索。有沒有什麼辦法可以將id定義爲「input [data-type ='search'」 – 2015-05-07 13:20:15