使用jQuery更改下拉列表的选定值
问题: I have a drop-down list with known values. 我有一个带有已知值的下拉列表。 What I'm trying to do is set the drop down list to a particular value that I know exists using jQuery. 我正在尝试将下拉列表设置为使用jQuery知道的特定值。 Using regular JavaScript, I would do something like: 使用常规JavaScript,我会做类似的事情: ddl = document.getElementById("ID of element goes here"); ddl.value = 2; // 2 being the value I want to set it too. However, I need to do this with jQuery, because I'm using a CSS class for my selector (stupid ASP.NET client ids...). 但是,我需要使用jQuery,因为我在选择器中使用了CSS类(愚蠢的 ASP.NET 客户端ID ...)。 Here are a few things I've tried: