Question:Which of the following is the correct way to select an option based on its text in jQuery? 

A $("#myselect option").filter(function(){ return $(this).text() == 'text';}).prop('selected', true); 

B $("#myselect option").prop('selected', true).text("text") 

C $("#myselect").filter("option").prop('selected', true).text("text"); 

D $("#myselect").filter(function(){ return $(this).val() == 'text';}).prop('selected', true); 

+ Answer
+ Report
Total Preview: 980

Copyright © 2024. Powered by Intellect Software Ltd