I'm trying to disable a textbox if a checkbox is not checked , and enable it if the checkbox is checked in javascript
here is my code but it's not working :
if($productsArray[$i])
{
$productName = $productsArray[$i]->getProductName() ;
$id = $productsArray[$i]->getId();
$product = $control->getNonFreshProductById($id);
$personAmount = $product->getPersonAmount() ;
echo "<tr>";
echo "<th td valign='middle' > <br/> <input type='checkbox' name='nonFreshProduct".$i."' id ='nonFreshProduct".$i."' style='position:absolute; left:20%' onclick='document.getElementById('outcome".$i."').disabled=!this.checked;'/>".$productName."</th>";
echo "<th td valign='middle' style='text-align:-webkit-left'> <br/> <input type='text' name='outcome".$i."' id ='outcome".$i."'/></th>";
echo "<input type='hidden' name='nfid".$i."' id='nfid".$id."' value='".$id." ' /></th>";
echo "</tr>";
}