Is there a way to loop through all elements within the MainDiv
Div in order to retrieve their values? Currently, I am only able to retrieve the value of the first element.
<div id="MainDiv">
<input type="text" id="MyText"value="Text1" />
<input type="text" id="MyText1" value="Text2" />
<textarea id="Textarea1">A</textarea>
<textarea id="Textarea2">B</textarea>
</div>
$('#MainDiv').each(function () {
var Value1 = $(this).find("input[type = 'text'][id^='MyText']").val();
alert(Value1);
var Value2 = $(this).find("[id^='Textarea']").val();
alert(Value2);
})