Populate textarea with contents of span
Hi,
I need to get the text within a span to populate within a textbox.
Texarea I would like to populate:
- <div id="GiftMessageOption" class="top-m btm-m">
- <h5>Gift Message</h5>
- <label for="giftMsg">
- <small>Please type your desired message (optional)</small>:<br />
- </label>
- <textarea class="Field validation productAttributeFluidWidth" id="giftMsg" value=""></textarea>
- <div class="cf"></div>
- </div>
Span I want the value of:
- <table class="productAttributes" cellpadding="0" cellspacing="2">
couple other tr's & td's...
<tr>
<td>
<label>Gift ​Messa​ge:</label>
</td>
<td>
<span>THIS IS THE VALUE I WANT</span>
</td>
</tr>
couple other tr's & td's...
</table>
I'm trying to target the span with it's label because they are both generated by an external server and the values change. The only consistency is that the label contains "Gift". I know this is a horrible way to go about things but in this case cannot be helped.
I've tried various things but this is my latest unsuccessful attempt:
$('#giftMsg').val($('label:contains("Gift")').parents('span').val());
Am I even close?
Thanks very much,
Susan