hi friends if 4 text box is created based on below code then while text box focus out then that text box value are append in dropdown list its working fine but while user can change the text box value i need to replace old textbox value to new value how can i do this please help me friends
My text box Creation and dropdown creation
<% for (int i = 0; i < Convert.ToInt16(Model.NumGroups); i++) { %> <tr> <td> <%: Html.Label("Group" + (i+1).ToString()) %><br /> <%: Html.TextBox("GroupName", null , new { id= i, @class = "GroupName" })%> </td> </tr> <%} %> <% for (int i = 0; i < Convert.ToInt16(Model.NumGroups); i++) { %> <tr> <td> <select classname = "GroupSelect"> <option></option></select> </td> </tr> <%} %>
My jquery
$('.GroupName').focusout(function () { var data = $(this).val(); var get = $(this).attr('id'); $('GroupSelect option')[parseInt(get + 1)].text = data; });