我想禁用Fieldset内的所有元素,但要启用其中的几个按钮。 演示:
<fieldset ng-disabled="true"> <legend>Personalia:</legend> Name: <input type="text"><br> Email: <input type="text"><br> Date of birth: <input type="text"> <input type="button" value="See More (Enable this!!) " ng-click="ButtonClicked1()" ng-disabled="false"/> Somethingelse: <input type="text"> <input type="button" value="View Details " ng-click="ButtonClicked2()"/> </fieldset>
试试这个:
HTML:
<fieldset id="form"> <legend>Personalia:</legend> Name: <input type="text" /><br /> Email: <input type="text" /><br /> Date of birth: <input type="text" /> <input id="btn1" type="button" value="See More (Enable this!!) " onclick="ButtonClicked1()" /> Somethingelse: <input type="text" /> <input type="button" value="View Details " onclick="ButtonClicked2()"/> </fieldset>
脚本:
$('#form :input').prop('disabled', true); $("#btn1").prop('disabled', false);