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 Link to comment https://forums.phpfreaks.com/topic/156420-solved-div-tag-value-issue/ 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? Link to comment https://forums.phpfreaks.com/topic/156420-solved-div-tag-value-issue/#findComment-823583 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 Link to comment https://forums.phpfreaks.com/topic/156420-solved-div-tag-value-issue/#findComment-823595 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.