2014-02-14 16 views
0

我實現這個jQuery UI的多選這裏是代碼jQuery的多選插件 - 如何從<a href="http://www.erichynds.com/jquery/jquery-ui-multiselect-widget" rel="nofollow">http://www.erichynds.com/jquery/jquery-ui-multiselect-widget</a></p> <p>得到selcetd文本

var array_of_checked_values = $("select").multiselect("getChecked").map(function(){ 
return this.value;  
}).get(); 

$("#ctl00_MainContent_lblAssigned").html(array_of_checked_values.join('<br/> ')); 

我在這裏得到value.I要選定的文本。怎麼做?誰能幫我?

非常感謝

回答

0

你想要的,而不是價值

var array_of_checked_values = $("select").multiselect("getChecked").map(function(){ 
return this.innerHTML;  
}).get(); 
+0

無..我想選擇的文本...例如值是23文本是Mohan.I想要Mohan。 – Madhu

0

返回的innerHTML,試試這個來獲取文本:

return $('.ui-multiselect-checkboxes').find('[aria-selected="true"]') 
             .next('span').text(); // to get the text 

見你多選改變DOM結構,所以你必須找到具有這個屬性的元素[aria-selected="true"]這是選擇特德複選框和這個元素旁邊是持有它的文本的跨度,所以你必須返回它的文本。

+0

沒有它的不工作 – Madhu

+0

是剛剛看到更新。 – Jai

+1

我應該在哪裏寫這段代碼... inplace of return this.value ??? – Madhu

相關問題