This is the error from my console from the script below,
Uncaught TypeError: Cannot set property 'onclick' of null
<script>
document.getElementById("finish_$pend[contractID]").onclick=function() {
if (document.getElementById("finish_$pend[name]_$i").style.display==="none") {
document.getElementById("finish_$pend[name]_$i").style.display="block";}
else {
document.getElementById("finish_$pend[name]_$i").style.display="none"}}
</script>
Heres the HTML Markup, for the script posted above
<div class="panel-body text-center">
<table class='table table-responsive'>
<?php
$user=$this->session->user_id;
$pending = $database->select("tbl_contract", "name, amount, contractID","userID = ".$user." AND paid = 1 AND confirmed = 0", "date ");
$i=1;
if (is_array($pending)) {
foreach($pending as $pend) { print <<<HERE
<tr>
<td>
<div style="border-bottom: 1px solid gainsboro; padding-bottom: 10px; text-align: left; color: grey">
<span>$i. $pend[name] - $$pend[amount]</span>
<!--<button id="finish_$pend[contractID]" style="position: absolute; right: 50px; background: orange; color: white; border-radius: 3px; margin-top: 3px; border: 1px solid orange">Checkout</button> -->
</td>
</tr>
</div>