我一直在搜索互联网并阅读了很多不同的方法来做到这一点,但由于某种原因,它们都不适合我。这里一定有我遗漏的东西。我要做的是在选中复选框时使用特定的选定值更新下拉列表。
用于选择的 HTML
<select data-hands-jqui-props="{"header":true,"height":175,"minWidth":225,"classes":"","checkAllText":"Check all","uncheckAllText":"Uncheck all","noneSelectedText":"Select option","selectedText":"# selected","selectedList":1,"autoOpen":false,"multiple":false,"disabled":false,"handsOnCreate":null}" data-hands-jqui-type="multiselect" data-val="true" data-val-date="The field must be a date." id="SundayOpen" name="SundayOpen"><option value=""></option>
<option value="4/17/2013 12:00:00 AM">12:00 AM</option>
<option value="4/17/2013 12:15:00 AM">12:15 AM</option>
<option value="4/17/2013 12:30:00 AM">12:30 AM</option>
<option value="4/17/2013 12:45:00 AM">12:45 AM</option>
<option value="4/17/2013 1:00:00 AM">1:00 AM</option>
<option value="4/17/2013 1:15:00 AM">1:15 AM</option>
<option value="4/17/2013 1:30:00 AM">1:30 AM</option>
<option value="4/17/2013 1:45:00 AM">1:45 AM</option>
<option value="4/17/2013 2:00:00 AM">2:00 AM</option>
<option value="4/17/2013 2:15:00 AM">2:15 AM</option>
<option value="4/17/2013 2:30:00 AM">2:30 AM</option>
<option value="4/17/2013 2:45:00 AM">2:45 AM</option>
<option value="4/17/2013 3:00:00 AM">3:00 AM</option>
<option value="4/17/2013 3:15:00 AM">3:15 AM</option>
<option value="4/17/2013 3:30:00 AM">3:30 AM</option>
<option value="4/17/2013 3:45:00 AM">3:45 AM</option>
<option value="4/17/2013 4:00:00 AM">4:00 AM</option>
<option value="4/17/2013 4:15:00 AM">4:15 AM</option>
<option value="4/17/2013 4:30:00 AM">4:30 AM</option>
<option value="4/17/2013 4:45:00 AM">4:45 AM</option>
<option value="4/17/2013 5:00:00 AM">5:00 AM</option>
<option value="4/17/2013 5:15:00 AM">5:15 AM</option>
<option value="4/17/2013 5:30:00 AM">5:30 AM</option>
<option value="4/17/2013 5:45:00 AM">5:45 AM</option>
<option value="4/17/2013 6:00:00 AM">6:00 AM</option>
<option value="4/17/2013 6:15:00 AM">6:15 AM</option>
<option value="4/17/2013 6:30:00 AM">6:30 AM</option>
<option value="4/17/2013 6:45:00 AM">6:45 AM</option>
<option value="4/17/2013 7:00:00 AM">7:00 AM</option>
<option value="4/17/2013 7:15:00 AM">7:15 AM</option>
<option value="4/17/2013 7:30:00 AM">7:30 AM</option>
<option value="4/17/2013 7:45:00 AM">7:45 AM</option>
<option value="4/17/2013 8:00:00 AM">8:00 AM</option>
<option value="4/17/2013 8:15:00 AM">8:15 AM</option>
<option value="4/17/2013 8:30:00 AM">8:30 AM</option>
<option value="4/17/2013 8:45:00 AM">8:45 AM</option>
<option value="4/17/2013 9:00:00 AM">9:00 AM</option>
<option value="4/17/2013 9:15:00 AM">9:15 AM</option>
<option value="4/17/2013 9:30:00 AM">9:30 AM</option>
<option value="4/17/2013 9:45:00 AM">9:45 AM</option>
<option value="4/17/2013 10:00:00 AM">10:00 AM</option>
<option value="4/17/2013 10:15:00 AM">10:15 AM</option>
<option value="4/17/2013 10:30:00 AM">10:30 AM</option>
<option value="4/17/2013 10:45:00 AM">10:45 AM</option>
<option value="4/17/2013 11:00:00 AM">11:00 AM</option>
<option value="4/17/2013 11:15:00 AM">11:15 AM</option>
<option value="4/17/2013 11:30:00 AM">11:30 AM</option>
<option value="4/17/2013 11:45:00 AM">11:45 AM</option>
<option value="4/17/2013 12:00:00 PM">12:00 PM</option>
<option value="4/17/2013 12:15:00 PM">12:15 PM</option>
<option value="4/17/2013 12:30:00 PM">12:30 PM</option>
<option value="4/17/2013 12:45:00 PM">12:45 PM</option>
<option value="4/17/2013 1:00:00 PM">1:00 PM</option>
<option value="4/17/2013 1:15:00 PM">1:15 PM</option>
<option value="4/17/2013 1:30:00 PM">1:30 PM</option>
<option value="4/17/2013 1:45:00 PM">1:45 PM</option>
<option value="4/17/2013 2:00:00 PM">2:00 PM</option>
<option value="4/17/2013 2:15:00 PM">2:15 PM</option>
<option value="4/17/2013 2:30:00 PM">2:30 PM</option>
<option value="4/17/2013 2:45:00 PM">2:45 PM</option>
<option value="4/17/2013 3:00:00 PM">3:00 PM</option>
<option value="4/17/2013 3:15:00 PM">3:15 PM</option>
<option value="4/17/2013 3:30:00 PM">3:30 PM</option>
<option value="4/17/2013 3:45:00 PM">3:45 PM</option>
<option value="4/17/2013 4:00:00 PM">4:00 PM</option>
<option value="4/17/2013 4:15:00 PM">4:15 PM</option>
<option value="4/17/2013 4:30:00 PM">4:30 PM</option>
<option value="4/17/2013 4:45:00 PM">4:45 PM</option>
<option value="4/17/2013 5:00:00 PM">5:00 PM</option>
<option value="4/17/2013 5:15:00 PM">5:15 PM</option>
<option value="4/17/2013 5:30:00 PM">5:30 PM</option>
<option value="4/17/2013 5:45:00 PM">5:45 PM</option>
<option value="4/17/2013 6:00:00 PM">6:00 PM</option>
<option value="4/17/2013 6:15:00 PM">6:15 PM</option>
<option value="4/17/2013 6:30:00 PM">6:30 PM</option>
<option value="4/17/2013 6:45:00 PM">6:45 PM</option>
<option value="4/17/2013 7:00:00 PM">7:00 PM</option>
<option value="4/17/2013 7:15:00 PM">7:15 PM</option>
<option value="4/17/2013 7:30:00 PM">7:30 PM</option>
<option value="4/17/2013 7:45:00 PM">7:45 PM</option>
<option value="4/17/2013 8:00:00 PM">8:00 PM</option>
<option value="4/17/2013 8:15:00 PM">8:15 PM</option>
<option value="4/17/2013 8:30:00 PM">8:30 PM</option>
<option value="4/17/2013 8:45:00 PM">8:45 PM</option>
<option value="4/17/2013 9:00:00 PM">9:00 PM</option>
<option value="4/17/2013 9:15:00 PM">9:15 PM</option>
<option value="4/17/2013 9:30:00 PM">9:30 PM</option>
<option value="4/17/2013 9:45:00 PM">9:45 PM</option>
<option value="4/17/2013 10:00:00 PM">10:00 PM</option>
<option value="4/17/2013 10:15:00 PM">10:15 PM</option>
<option value="4/17/2013 10:30:00 PM">10:30 PM</option>
<option value="4/17/2013 10:45:00 PM">10:45 PM</option>
<option value="4/17/2013 11:00:00 PM">11:00 PM</option>
<option value="4/17/2013 11:15:00 PM">11:15 PM</option>
<option value="4/17/2013 11:30:00 PM">11:30 PM</option>
<option value="4/17/2013 11:45:00 PM">11:45 PM</option>
</select>
jQuery
if (IsPreFillOn) {
$("#SundayOpen option[value='4/17/2013 12:30:00 AM']").attr("selected","selected");
alert($("#SundayOpen").val());
}
document.ready 未显示,但存在。有趣的是,警报显示了正确的值,但实际的下拉列表没有更新。
对可能发生的事情有任何想法吗?