这是我的静态下拉代码。如何禁用下拉列表或删除用于选择值的选项
<?php
$designationsOptions = array('0'=> 'Select Weekly Day Off','Sunday' => 'Sunday','Monday' => 'Monday','Tuesday' => 'Tuesday','Wednesday' => 'Wednesday','Thursday' => 'Thursday','Friday' => 'Friday','Saturday' => 'Saturday');
$designationsOptionsJs = 'id="shiftDayOff" class="form-control shiftDayOff"';
echo "<div class='drop_shiftDayOff'>";
echo form_dropdown('shiftDayOff', $designationsOptions,$shifts[0]['shiftDayOff'],$designationsOptionsJs);
echo "</div>";
?>
您可以将以下字符串添加到$designationsOptionsJs变量中:
$designationsOptionsJs += " disabled=disabled";
这应该有效。