I need to toggle a button state between enabled/disabled if I change the default value of a select element. Take this HTML as example:
<select
ng-change="statusBtn(btnUpdFee, updFee)"
ng-options="
wt.id as
wt.name for wt in wtax"
ng-model="updFee"
class="ng-pristine ng-valid"
>
<option value="0" selected="selected">cm-534be5d66aea3</option>
<option value="1" selected="selected">cm-534be5d681a02</option>
<option value="2">cm-534be5d68316e</option>
</select>
<button disabled="" ng-click="showCommentModal('updateFee')" class="btn btn-success" id="btnUpdFee"><i class="icon-ok"></i></button>
And this is the code I wrote but it's not working:
$scope.statusBtn = function(btnId, curValue) {
if (curValue != $scope.updFee) {
$("#" + btnId).removeAttr("disabled");
} else {
$("#" + btnId).attr("disabled");
}
}