因此,当单击时,我modalLink
想从td
this 内部tr
而不是 other内部获取并保存数据值tr
<tr date-user-id="1NJD3A" data-user-details="{...}" class="">
<td class="table-request-btn incoming-icon">
<button class="modalLink" href="#modalrequest">Request Intro</button>
</td>
<td class="data-name request-row">
Joe Blow
</td>
<td class="data-career request-row">
Administrator
</td>
<td class="data-company request-row">
Acme
</td>
</tr>
到目前为止,我的函数抛出了一个无法实现的 Uncaught TypeError
你会如何处理这个问题?
var wireSearchTable = function() {
$('.modalLink').unbind('click').bind('click', function () {
var request_name = $(this).parents('tr').siblings.data('name');
var request_title = $(this).siblings.data('career');
var request_company = $(this).siblings.data('company');
requestIntroModal.wireRequestIntroModal(details);
console.log('request_name = '+request_name);
console.log('request_title = '+request_title);
console.log('request_company = '+request_company);
});
};