To Read Select Option Value

$('#selectId').val(); 

To Set Select Option Value

$('#selectId').val('newValue'); 

To Read Selected Text

$('#selectId>option:selected').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; 

相关文章:

  • 2021-05-20
  • 2021-10-17
  • 2021-08-06
  • 2021-06-10
猜你喜欢
  • 2022-01-28
  • 2022-03-04
  • 2022-12-23
  • 2022-12-23
  • 2021-05-25
  • 2021-07-12
相关资源
相似解决方案