Reputation: 19
So i must be missing something here but after reading and looking at demo this is refusing to work. This is a basic demo to get it to work, but its still not. I have tried many combos to get this to:
data('total-contract-act')
data('totalContractAct')
data('totalcontractact')
alert( $('table.wip-detail-list').data('totalContractAct') );
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table class="wip-detail-list">
<tr>
<td class="col-sm-3 data-actual" data-total-contract-act="880.00">$880.00</td>
</tr>
</table>
Upvotes: 0
Views: 33
Reputation: 782498
The data-total-contract-act
attribute is in the <td>
, not the <table>
. You need to select the correct element.
console.log( $('table.wip-detail-list td.data-actual').data('totalContractAct') );
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table class="wip-detail-list">
<tr>
<td class="col-sm-3 data-actual" data-total-contract-act="880.00">$880.00</td>
</tr>
</table>
console.log( $('table.wip-detail-list td.data-est').data('hoursEst') );
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table class="wip-detail-list">
<tr>
<td class="col-sm-1 icon">icon</td>
<td class="col-sm-5 title">Hours</td>
<td class="col-sm-3 data-actual" data-hours-act="-">-</td>
<td class="col-sm-3 data-est" data-hours-est="195.00">195.00</td>
</tr>
</table>
Upvotes: 1