I have a form where when something is updated, I need to change the name of that item in a select input. I'm using this to loop through the options, but I'm having trouble figuring out how to change the text value. Here is what I tried
$('#GroupID option').each(function () {
if ($(this).val() == currently_editing_group_id)
$(this).attr('text', $('#NewGroupName').val());
});
Here is the select input
<select id="PracticeGroupID" name="GroupID">
<option value="5">Test Group 1</option>
<option value="6">Test Group 2</option>