ainoy31 Posted May 1, 2009 Share Posted May 1, 2009 I am trying to get the value from a <div> tag. Here is my JS code: function checkRefund() { var price=document.getElementById("price").value; var ref=document.query_simple.refund.value; document.write(price); if(refund > price) { alert("The refund amount can not be greater than the current price amount"); return false; } return true; } Here is the rest of the code: <td class="LT">Price</td><td class="LT"><div class="fld narrow" id="price"><?php printf("%.2f", $record->fields['price']) ?></div></td> <td class="LT">Refund</td><td class="LT" colspan="5"><input type="text" name="refund" value="<?php printf("%.2f", $record->fields['refund']) ?>" onblur="checkRefund();"></input></td></tr> This prints out undefined for the price value. Much appreciation AM Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 1, 2009 Share Posted May 1, 2009 So is this a JavaScript problem or a PHP problem? I'm confused what you need help on. Also, what's query_simple in your JavaScript? Quote Link to comment Share on other sites More sharing options...
ainoy31 Posted May 1, 2009 Author Share Posted May 1, 2009 This is a JS issue. I figured it out. I am not going to use the DIV. Instead, I am going to use the <input>. This is easier to retrieve the value of my element. "query_simple" is the form name. Later. AM Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.