【发布时间】:2011-06-20 14:13:48
【问题描述】:
html如下:
<table class="tablesorter">
<g:each in="${vehicleInstanceList}" status="i" var="vehicleInstance">
<tr class="${(i % 2) == 0 ? 'odd' : 'even'}" id ="rows">
<td >
<g:checkBox id = "isActive_${i}" class="isActive" name="isActive" value="${vehicleInstance?.isActive}" />
<input type="hidden" value="${vehicleInstance?.id}" name="vehicleId" id="isActive_${i}_" />
</td>
</tr>
和 Jquery :
$(".isActive").click(function() {
var checkBox_id = $(this).attr("id"); // getting the id of checkbox
var isActive = // get the value of checkbox
var vehicleId = // get the value of hidden input element
});
我必须获取复选框和隐藏输入元素的值我该怎么做? isActive 是一个布尔类型,我想用真/假来回答,如果检查为真,则为假
var isActive = $('#'+checkBox).is(':checked'); i have tried to get value of checkbox but it always gives output as false
【问题讨论】:
标签: jquery