jQuery dynamic selector
You should use the val() function:
var myValue = $("#new_grouping_"+i).val(); // to get the value
$("#new_grouping_"+i).val("something"); // to set the value
$("#new_grouping_"+i).val()
gets you the value of a form.$("#new_grouping_"+i).text()
gets you the text of an html element.$("#new_grouping_"+i).html()
gets you the html of an html element.
$("#new_grouping_"+i).val('value')
sets the value of a form.$("#new_grouping_"+i).text('value')
sets the text of an html element.$("#new_grouping_"+i).html('value')
sets the html of an html element.
$("#new_grouping_"+i).append('value')
prepends something at the beginning of an element
$("#new_grouping_"+i).append('value')
appends something at end of an element
$("#new_grouping_"+i).before('value')
places something before an element
$("#new_grouping_"+i).after('value')
places something after an element.
See More: jQuery Manipulation
# is important for selector. Here I am setting value to span.
var i="spanId";
$("#"+ i).html("hello").show();