ドロップダウン チェックリストをフォームに取り込もうとしていますが、DDCLを正しく表示できません。これは、期待どおりに動作する DDCL だけを示すフィドルです。セレクターに小さな変更を加えて 、 JQuery-UI モーダル フォームの修正例にそれを組み込みました。 使用可能な DDCL をレンダリングするのではなく、代わりに小さな小さなボックスをレンダリングします。「Add New Instrument」ボタンをクリックして、私が話していることを確認してください。
SO で参照用に入手したコードの HTML スニペットを次に示します (完全なコードについては、上記の「動作しない例...」を参照してください)。
<form>
<fieldset>
<label for="modelNumber">Model Number</label>
<input type="text" name="modelNumber" id="modelNumber" class="text ui-widget-content ui-corner-all" />
<label for="partNumber">Part Number</label>
<input type="text" name="partNumber" id="partNumber" value="" class="text ui-widget-content ui-corner-all" />
<label for="serialNumber">Serial Number</label>
<input type="text" name="serialNumber" id="serialNumber" value="" class="text ui-widget-content ui-corner-all" />
<label for="services">Requested Services</label>
<select id="services" name="services" multiple="multiple">
<optgroup label="Calibration">
<option>Temperature</option>
<option>Conductivity</option>
<option>Pressure</option>
<option>Dissolved Oxygen</option>
<option>pH</option>
</optgroup>
<optgroup label="Repairs">
<option>O-Ring Replacement & Inspection</option>
<option>Hydrostatic Test</option>
<option>Diagnose & Repair Problems</option>
<option>Replace Anti-Foulant Devices</option>
<option>Download Data From Instrument</option>
</optgroup>
<optgroup label="Third Party Sensors">
<option>Fluorometer</option>
<option>Transmissometer</option>
<option>Turbidity</option>
<option>SUNA</option>
<option>PAR</option>
</optgroup>
</select>
</fieldset>
</form>
これを機能させるJSは次のとおりです。
$(document).ready(function() {
$("#services").dropdownchecklist();
});
私は何が欠けていますか?ラベルの下に何かがレンダリングされていることがわかりますが、期待しているドロップダウン ボックスではなく、薄い小さなボックスです。これはおそらくCSSの競合であると思いますか?ページ上の CSS を削除しましたが、ほとんど同じ結果 (すべての場合で使用できない小さなボックス) が得られました。外部リソースは両方のフィドルで同一であると確信していますが、同じ順序ではない可能性があります。それらのほとんどを追加および削除してテストしたので、外部リソースが問題ではないと確信していますが、それを軽視することはありません.