Jump to content

[SOLVED] DIV tag value issue


ainoy31

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.