我有一个表格,每行有 1 个按钮,单击该行中显示的按钮税将应用于客户端,我需要向最终用户显示一些指示。为此,我想在单击时更改按钮 css(color, txt ect.)。下面是代码 -
<table class="data report_table">
<tbody>
<c:forEach var="taxVO" items="${taxVo}" varStatus="item">
<tr class="${item.index % 2 == 0 ? 'odd gradeX' : 'even gradeC'}">
<td><c:out value="${taxVO.taxName}" /></td>
<td><input type="button" class="btn-icon" value="Apply" id="applyTaxButton" onClick="applyTax('${taxVO.taxId}');"></input>
</td>
</tr>
</c:forEach>
</tbody>
</table>
我正在使用的jquery是-
function applyTax(taxIdValue) {
$('#taxId').val(taxIdValue);
$(this).$('#applyTaxButton').css("background-color","yellow");
}
但我收到错误 - 未捕获的类型错误:对象 [对象对象] 没有方法“$”。有人可以让我知道如何解决吗?