我去你有上面列出的網站,並能夠在運行這個我鉻控制檯:
$('.ui-multiselect .selected li').each(function(idx,el){ console.log(el.title); });
看起來你想要的值存儲在div.selected元素內的列表項的標題屬性中。
編輯:
衛生署!當然,你想要的價值。不好意思,朋友。完全錯過了。真正的商品存儲在jQuery data()對象中。在這種情況下,你想要的關鍵是'optionLink'。它維護對選項元素的引用。 '.selected'div中的每個列表項都使用jQuery.data()方法向其添加基礎選項。
因此,您需要獲取選定的列表項,迭代,從數據jQuery數據存儲中抓取'optionLink',然後獲取該值。
下面的代碼工作示例頁面上:
$('.ui-multiselect .selected li').each(function(idx,el){
console.log(el);
var link = $(el).data('optionLink');
// link now points to a jQuery wrapped <option> tag
// I do a test on link first. not sure why, but one of them was undefined.
// however, I got all four values. So I'm not sure what the first <li>
// is. I'm thinking it's the header...
if(link){
// here's your value. add it to an array, or whatever you need to do.
console.log(link.val());
}
});
這是第一個我所見過的多選的。它很光滑。但我同情你的挫折試圖找出一些東西。 'getSelectedOptions()'方法會很好。
乾杯
我需要的字段值,而不是它的名稱(這確實是標題)http://clip2net.com/s/ 1swzK有名字,但沒有值。而且我無法使用它的文本搜索字段的值,因爲我放入多選控件的數據正在脫離社交網絡,並且保存1k海量數據並不明智,然後發佈它們,然後按名稱搜索值,然後給出結果給用戶:s仍然需要你的幫助maestro和感謝張貼:) – 966p 2012-01-05 22:49:47
好吧。編輯帖子並添加代碼以獲取值。祝你好運! – 2012-01-06 03:17:17
太棒了!讓我吻你哈哈:))非常感謝你,我的例子是可用http://russia-golosuet.ru/otkr/test.php – 966p 2012-01-06 09:25:16