Mar 09, 2018 07:07 PM|lewis886|LINK
I've got an update to make to an html template. Basically I need to grab a couple values, do a calculation, and update a field with the result.
The page was set up as an HTML template. The template is grabbed, and the data that will be populated into the template is embedded into the page as XML, then the data is populated throughout the page using the "datafld" attribute of "div" elements. Here
you can see the top where the XML is embedded, and then below that I give you an example of how the data is populated into the page.
<?xml version='1.0' ?>
<description>Description of Item</description>
<table border="0" width="100%" cellspacing="3" cellpadding="1" datasrc="#XmlData">
<td width="30%" align="left" class="Detail">Quantity: </td>
<td><div id="qtyID" datafld="quantity"></div></td>
The problem is, when I grab the div where the datafld is being used, it simply grabs the datafld attribute (ex above, "quantity"). I can't grab the actual value "3". So, my question is, is there a good way to grab the actual value that the datafld is referencing
using jQuery? Or, is there a good way to grab the tag value from the embedded XML section directly, using jQuery? I can't change anything about how the XML gets embedded (such as adding attributes to the tags or anything).
The closest I have come is using the code below, which grabs the datafld property, meaning it returns "quantity".
var Quantity = $("#qtyID").attr("datafld");