Reputation: 33
In the below code i have a dynamic textbox and javascript function.I want to get value from particular text box by spiliting the value by $ .But my actual result i can get the value from particular dynamic textbox and different textbox by spilting the value by $ .Pls help me to get value from particular dynamic textbox. Asp.net
<asp:TextBox ID="txtField" runat="server" width="200Px"></asp:TextBox>
JS:
str = "";
$('input[type=text]').each(function () {
str += $(this).val() + "$";
});
if (str != "")
str = str.substring(0, str.length - 1);
alert(str);
Upvotes: 0
Views: 234
Reputation: 7240
Just an idea:
When you create dynamic textfields, give define them with a specific class
say dyn
:
str = "";
$('input[type=text] .dyn').each(function () {
str += $(this).val() + "$";
});
//your furthur codes
Upvotes: 1