vendredi 28 novembre 2014

jquery find cell value, if exists change cell, if not add new row


Any help would be greatly appreciated,


what i'm trying to achieve is when a number/text in input into the code box it searches the table, if found increments qty by one, if not found adds a new row counting the no column by 1


i already a some basic jQuery code but would rather not post beginners code lol


Thanks in advance.



<input type="text" style="width: 200px" id="code" name="code" />
<input id = "btnSubmit" type="submit" value="Release"/>
<table> <thead>
<tr>
<th>No</th>
<th>Code</th>
<th>Qty</th>

</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>4444</td>
<td>1</td>
</tr>
<tr>
<td>2</td>
<td>5555</td>
<td>1</td>

</tr>
<tr>
<td>3</td>
<td>6666</td>
<td>1</td>

</tr>
<tr>
<td>4</td>
<td>7777</td>
<td>1</td>

</tr>
</tbody>
</table>




Aucun commentaire:

Enregistrer un commentaire