所以當modalLink
被點擊我想抓住,並從其他td
保存小號jQuery如何定位這些兄弟姐妹的數據?
<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>
我的功能,到目前爲止它拋出的這個tr
而不是其他tr
內「的數據值無法解決的類型錯誤
您將如何處理此問題?
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);
});
};
你能展示一個生成的HTML樣本(而不是你用來創建HTML的模板)嗎? –
點符號,喲 – JeffRegan
更新了HTML @DavidThomas謝謝! –