我有一个针对正在由所选的jQuery插件显示的选择框的代码。 我试图做到的,是让从已经选择了当前项的值:
<div>
<select id="schedule_event" name="schedule[event]" style="display: none; " class="chzn-done"><option value="Game" selected="selected">Game</option>
<option value="Event">Event</option>
<option value="Training">Training</option>
</select>
<div id="schedule_event_chzn" class="chzn-container chzn-container-single chzn-container-active" style="width: 854px; ">
<a href="javascript:void(0)" class="chzn-single chzn-single-with-drop" tabindex="-1">
<span>Game</span>
<div></div>
</a>
<div class="chzn-drop" style="width: 849px; top: 27px; left: 0px; ">
<div class="chzn-search">
<input type="text" autocomplete="off" style="width: 814px; " tabindex="0">
</div>
<ul class="chzn-results">
<li id="schedule_event_chzn_o_0" class="active-result result-selected highlighted" style="">Game</li>
<li id="schedule_event_chzn_o_1" class="active-result" style="">Event</li>
<li id="schedule_event_chzn_o_2" class="active-result" style="">Training</li>
</ul>
</div>
</div>
</div>
我使用的是目前发现的当前值的JavaScript是:
$("#schedule_event").chosen().change( function() {
alert(+ $(this).text());
$('#' + $(this).val()).show();
});
不过,我不断收到一个“男”,即没有价值。