我有something.php
,会打印dropdownlist
选项,\
然后我用
加载.php
文件
$("#dropdownlist").load("something.php");
加载后,显示输出,但是当我更改所选值时,在调试模式下,我没有在selected="selected"
的选项上看到dropdownlist
而我无法设置{{1使用
selectedvalue
dropdownlist
任何人都知道为什么会发生这种情况,我该如何解决?
- $("#dropdownlist").val("2");
上的打印选项 -
.php
---拨打while (isset($StatusArr[$loopCount])) {
if ($loopCount == 0) {
$selected = "selected='true'";
} else {
$selected = "";
}
echo "<option value='"
. $StatusArr[$loopCount][0]
. "' "
. $selected
. " >"
. $StatusArr[$loopCount][1]
. "</option>";
$loopCount ++;
}
----
.js
答案 0 :(得分:4)
vsDiffmerge.exe
此jQuery代码将下拉列表的选定选项设置为第二个选项。