如果在下拉列表中未选择任何内容,则禁用按钮
Disable Button if nothing is selected at the dropdown
当下拉菜单中没有选择任何内容时,该按钮应该被禁用。我怎样才能做到这一点?
<select size='1' id="action" ng-model="ak.action">
<option value='1'>RED</option>
<option value='2'>BLUE</option>
</select>
<div>
<button type="button" ng-Click="ak.save()" >SAVE</button>
</div>
尝试在按钮上使用 ng-disabled="!ak.action || ak.action.length == 0"
。
虽然 select
在您的案例中总是有一个选定的项目...
<select size='1' id="action" ng-model="ak.action">
<option value='1'>RED</option>
<option value='2'>BLUE</option>
</select>
<div>
<button ng-disabled="!ak.action || ak.action.length == 0" type="button" ng-click="ak.save()" >SAVE</button>
</div>
当下拉菜单中没有选择任何内容时,该按钮应该被禁用。我怎样才能做到这一点?
<select size='1' id="action" ng-model="ak.action">
<option value='1'>RED</option>
<option value='2'>BLUE</option>
</select>
<div>
<button type="button" ng-Click="ak.save()" >SAVE</button>
</div>
尝试在按钮上使用 ng-disabled="!ak.action || ak.action.length == 0"
。
虽然 select
在您的案例中总是有一个选定的项目...
<select size='1' id="action" ng-model="ak.action">
<option value='1'>RED</option>
<option value='2'>BLUE</option>
</select>
<div>
<button ng-disabled="!ak.action || ak.action.length == 0" type="button" ng-click="ak.save()" >SAVE</button>
</div>