https://i.imgur.com/aLT1fdM.png
https://i.imgur.com/rppnpbo.png
Python/django环境
|      1CodeDrift OP | 
|      2hpfs0      2015-04-29 17:22:31 +08:00 $("#detial").find("option[value=这里可以GET得到]").attr("selected",true); | 
|      4CodeDrift OP @hpfs0 忘记打#了。。不行。 alert($("#detail").find("option[value='2']").val()); alert($('#detail option:first').val()); 都不行。。 | 
|      6hpfs0      2015-04-29 17:30:00 +08:00  1 @Anybfans 哦,那可以在后台就把要默认选择的那项selected属性设置好就可以了,传到前台的时候动态组装select就可以了 | 
|  |      7davepkxxx      2015-04-29 17:30:19 +08:00  1 @hpfs0 把attr("selected",true) 换成 prop("selected", "true") 比较好 | 
|  |      9ALeo      2015-04-29 17:40:51 +08:00  1 $( "#myselect option:selected" ).val() | 
|      10hpfs0      2015-04-29 17:44:58 +08:00 @Anybfans 刚才试了下,用$("#detail option").each(function() { this.selected = (this.value == "3"); });就可以了。 | 
|      11CodeDrift OP | 
|      12CodeDrift OP 貌似必须放$.post里面。。出来就不行了。。 |