I have been stuck trying to update the title attribute of a TextBoxFor control to show whatever is currently in the box. Seems like this should be fairly straight forward but I cannot figure it out for the life of me. I currently have the following that is pulling from my model. What I need is to make it update to whatever the value of the textbox is on change.
@Html.TextBoxFor(model => model.Earn.PurgeCriteriaInfo, new { style = "width:100%;", readOnly = "true;", Title = Model.Earn.PurgeCriteriaInfo })
You need to handle the .change
event of the textbox and update the attribute
$('#Earn_PurgeCriteriaInfo').change(function() {
$(this).attr('title', $(this).val());
});