jquery select set selectindex

卫宁
2023-12-01

To Read Select Option Value

$().val(); 

To Set Select Option Value

$().val(); 

To Read Selected Text

$().text(); 

 

 

// sets selected index of a select box to the option with the value "0" 
$
("select#elem").val('0');  
 
// sets selected index of a select box to the option with the value "" 
$
("select#elem").val('');  
 
// sets selected index to first item using the DOM 
$
("select#elem")[0].selectedIndex = 0; 




本文转自94cool博客园博客,原文链接:http://www.cnblogs.com/94cool/archive/2011/11/21/2256634.html,如需转载请自行联系原作者

 类似资料:

相关阅读

相关文章

相关问答