I can not get the value for the hidden input element from this table.
Here is my table:
<table id="scrapApprovalTable" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Company</th>
<th>Notes</th>
<th>Comments</th>
<th></th>
</tr>
</thead>
<tbody>
<cfoutput>
<cfloop query="GetRequests">
<tr class="#specialPricingScrapID#" id="#specialPricingScrapID#">
<td class="details-control" value="#specialPricingScrapID#"></td>
<td class="date">#DateFormat('#enterDate#', 'mm-dd-yyyy')#</td>
<td class="company"><a href="http://www.pblead.com/cfleadsource/MarMgt.cfm?ContactID=#contactid###ContactInfo" target="_blank">#company#</a>
</td>
<td class="notes">#notes#</td>
<td class="comments">
<textarea name="processingScrapComments-<cfoutput>#specialPricingScrapID#</cfoutput>" id="processingScrapComments-<cfoutput>#specialPricingScrapID#</cfoutput>" cols="30" rows="5"></textarea>
</td>
<td class="buttons">
<input type="hidden" id="requestID" value="#specialPricingScrapID#">
<button class="btn btn-success btn-block btn-small" id="btn-ApproveScrapRequest" name="btn-ApproveScrap" onclick="processRequest(#specialPricingScrapID#, #contactid#, #userid#)">Approve</button>
<br>
<button class="btn btn-danger btn-block" id="btn-RejectScrapRequest" name="btn-RejectScrap" onclick="processDenial(#specialPricingScrapID#, #contactid#, #userid#)">Deny</button>
<br>
</td>
</tr>
</cfloop>
</cfoutput>
</tbody>
</table>
Here is my javascript I am using:
$(document).ready(function () {
var approvalTable = $('#scrapApprovalTable').DataTable();
$('#scrapApprovalTable tbody').on('click', 'td.details-control', function (e) {
e.stopPropagation();
var $this = $(this);
var trid = $this.closest('tr').data('id');
alert("TR ID " + trid);
var tdid = $this.find('td[data-id]').data('id');
alert("TD ID " + tdid);
});
});
I am just wanting to get the value of
all of which are the same value. What I am trying to accomplish is to get the value so that I can do another request.
thanks for everyone's help.
This table is loaded directly on creation.
使用下面的代码获取<tr>
元素的id
属性的值:
$(this).closest('tr').attr('id');
var approvalTable = $('#scrapApprovalTable').DataTable();
$('#scrapApprovalTable tbody').on('click', 'td.details-control', function (e) {
e.stopPropagation();
var $this = $(this);
var trid = $this.closest('tr').attr('id');
alert("TR ID " + trid);
var tdid = $this.find('td#' + trid).attr('id');
alert("TD ID " + tdid);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.