I have some radio buttons that are created dynamically with javascript. I need to figure out how to reference the text in a div (also created dynamically) Here is sample html:
<div>
<div class="div_ceck"><input id="shipping_service_1" name="sid" value="1" type="radio"></div>
<div class="free"><label for="shipping_service_1" id="shipping_service_price_1">Free</label></div>
<br class="clr">
<div class="div_ceck"><input id="shipping_service_2" name="sid" value="2" type="radio"></div>
<div class="free"><label for="shipping_service_2" id="shipping_service_price_2">14.00</label></div>
</div>
So when the dynamic radio button "shipping_service_2" is clicked I would like to alert "14.00" - "shipping_service_price_2 id's text.
Here is my (non-working) code so far
$("input[name='sid']").live("change", function() {
var id = $(this).val();
alert($("#shipping_service_price_" + id).text())
})
});
EDIT: Thanks for the responses. The projects code was producing some malformed html which is why I was unable to select the text. the html above was just used for testing and does in fact work (yes, I am a moran)