How to dynamically retrieve values from input text box :
$(":input").each(function(){alert($(this).text());});
Case :
Dynamically column names are taken from xml source & binded in this manner :
<script type="text/javascript" language="javascript">
$(document).ready(function(){
$.ajax({
type: "GET",
url: "GetColumnNames.xml",
dataType: "xml",
success: function(xml) {
var cWidth = 100/(xml.getElementsByTagName("Column")).length;
$(xml).find('Column').each(function(){
var cId = $(this).find('Id').text();
var cName = $(this).find('Name').text();
$('<td id='+cId+' width='+cWidth+'>'+cName+'</td>').appendTo('#page-wrap');
$('<label for='+cName+'>'+cName+'<input type="text" name='+cName+'id='+cName+' value="" class="text ui-widget-content ui-corner-all" /></label>').appendTo('#moreItems');
});
}
});
});
</script>
The #moreItems
is part of another div which is part of modal popup and i want to access values within that,
So,
after validation i go this way :
if ( bValid ) {
$(":text").each(function(){
alert($(this).text());
});
}
But still i am not able to access input values.
Note :
It is not similar to :
How do I retrieve a textbox value using JQuery? , Jquery retrieve values of Dynamically created elements , how do i retrieve a textbox's title and name using jquery? ,
Looking for your help ..
Thanks.
You're missing a
$
sign. It should be:You should also try to generate well-formed HTML, with attributes delimited by quote characters: