3 Replies - 2387 Views - Last Post: 20 August 2012 - 12:53 AM

#1 rehmansayani  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 19-August 12

HTML array multiplication dyanmically in javascript

Posted 19 August 2012 - 12:21 PM

The problem is that this is the html generated row
<td><input name="itemCode[]" value="" class="tInput" id="itemCode" tabindex="1"/> </td>
<td><input name="itemDesc[]" value="" class="tInput" id="itemDesc"  readonly="readonly" /></td>
<td><input name="itemQty[]" value="" class="tInput" id="itemQty" tabindex="2" /></td>
<td><input name="itemPrice[]" value="" class="tInputt" id="itemPrice" readonly /> </td>
<td><input name="total[]" value="" readonly id="totalprice" /> </td>


BUT now onwards all the rows are generated by Javascript
 '<td><a id="deleteRow"><img src="images/icon-minus.png" alt="Remove Item" title="Remove Item"></a></td>',
'<td><input name="itemCode[]" class="tInput" value="" id="itemCode" /> </td>',
'<td><input name="itemDesc[]" class="tInput" value="" id="itemDesc"  readonly="readonly" /></td>',
'<td><input name="itemQty[]" value="" class="tInput" id="itemQty"  /></td>',
'<td><input name="itemPrice[]" class="tInput" value="" id="itemPrice" /></td>',
' <td><input name="total[]" value="" readonly  id="totalprice" /> </td>', 


i want to multiply quantity and price and send the output in total price before the new row added ..below image will more clarify a;; this

Attached image(s)

  • Attached Image

This post has been edited by Atli: 19 August 2012 - 12:50 PM
Reason for edit:: Added [code] tags, and edited the email address out of the screenshot.


Is This A Good Question/Topic? 0
  • +

Replies To: HTML array multiplication dyanmically in javascript

#2 William_Wilson  Icon User is offline

  • lost in compilation
  • member icon

Reputation: 205
  • View blog
  • Posts: 4,807
  • Joined: 23-December 05

Re: HTML array multiplication dyanmically in javascript

Posted 19 August 2012 - 01:11 PM

ids should only be used once. They are intended to identify a single tag, if multiple tags are to implement the same CSS or naming, it should be a class value instead.

One option would be to keep a count of the rows and append it to the id of each row. This will give each row a way to access specific items by id and keeps the ids unique which conforms to standards.
http://www.w3schools...standard_id.asp
Was This Post Helpful? 0
  • +
  • -

#3 rehmansayani  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 19-August 12

Re: HTML array multiplication dyanmically in javascript

Posted 19 August 2012 - 11:33 PM

but the point is how to count the row and how to send the values to java script function
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3577
  • View blog
  • Posts: 10,444
  • Joined: 08-June 10

Re: HTML array multiplication dyanmically in javascript

Posted 20 August 2012 - 12:53 AM

on the other-hand-side, each of the fields concerned is in the same table row ...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1