[英]How to get value from specific cell from a HTML table with JavaScript
所以我有一个看起来像这样的表(AngularJS):
<tr id="table">
<td style="text-align: center">{{flight.FlightFrom}}</td>
<td style="text-align: center">{{flight.FlightTo}}</td>
<td style="text-align: center">{{flight.Departure}}</td>
<td style="text-align: center">{{flight.Arrival}}</td>
<td style="text-align: center">{{flight.Price | currency: "PLN "}}</td>
<td style="text-align: center" id="sits">{{flight.AvailableSits}}</td>
<td><button type="button" id="buttonBuy">Kup bilet!</button></td>
</tr>
我想得到{{flight.AvailableSits}}
值,检查它是否等于0,如果是,那么我想禁用“购买”按钮。 我该怎么做?
尝试这个:
<td><button type="button" id="buttonBuy" ng-disabled="flight.AvailableSits === 0">Kup bilet!</button></td>
您可以在按钮上使用ng-show
指令。
<button type="button" id="buttonBuy" ng-show="flight.AvailableSits">Kup bilet!</button>
这将仅在有可用座位时显示按钮
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.