A simple question for jquery ninjas I'm sure.
(yes, i DO want to use jquery)
Lets say I have a 3 column table like this:
Code:
<table>
<tbody>
<tr class="sal-calc">
<td>Bob</td>
<td>Smith</td>
<td>50,000</td>
</tr>
<tr class="sal-calc">
<td>Bill</td>
<td>Green</td>
<td>40,000</td>
</tr>
<tr class="sal-calc">
<td>John</td>
<td>Brown</td>
<td>60,000</td>
</tr>
</tbody>
</table>
And I have a placeholder selection element like this:
Code:
<label>Select employee:</label>
<select class="emp-tbl">
<option value="0" selected="selected"> - </option>
</select>
And I want to take the first two <td> values as the concatenated text
AND
take the third <td> value and use it as the "value" attribute for each selector.
So the end result should look like this:
Code:
<label>Select employee:</label>
<select class="emp-tbl">
<option value="0" selected="selected"> - </option>
<option value="50,000">Bob Smith</option>
<option value="40,000">Bill Green</option>
<option value="60,000">John Brown</option>
</select>
Hints, peoples?
__________________
Please login or register to view this content. Registration is FREE "Order a PEBBLE Smart Watch for Bluetooth connection to your iPhone or Android" - 100% Waterproof - 7+ days Battery Charge - High Res Outdoor Readable - Vibrating Alert - Incoming Caller ID
Last edited by TWD; 06-14-2012 at 09:35 AM..
|