Click here to Skip to main content
14,699,541 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {

var email = eval('<%=valueEmail%>');
var name = eval('<%=Values%>');
if (email != null) {
var html = "";
$(email).each(function () {
var div = $("
");
div.html(GetDynamicTextBox(name,email));
$("#TextBoxContainer").append(div);

});
}
$("#btnAdd").bind("click", function () {
var div = $("
");
div.html(GetDynamicTextBox(""));
$("#TextBoxContainer").append(div);
return false;
});
$("body").on("click", ".remove", function () {
$(this).closest("div").remove();
});
});
function GetDynamicTextBox(valuename,valueemail) {
return '<input name = "ContactName" type="text" value = "' + valuename + '" /> ' + '<input name = "ContactEmail" type="text" value = "' + valueemail + '" /> ' +
'<input type="button" value="Remove" class="remove" />'
}
</script>

What I have tried:

I am trying to add values in my dynamic textboxes.when i add more than 1 textboxes and insert values into them,on page reload the 1st textbox value copied to next one and cycle continues.on every page load the values gets copied to next textbox.what i have to do to prevent it.please help
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900