how to implement read more and less functionality for dynamic string inside foreach block in mvc.
@foreach (var item in ViewBag.Texts)
{
<div>
<span class="LongString">@item </span>
<button class="ReadLess">Read Less</button>
</div>
}
public ActionResult ReadMore()
{
List<string> lists = new List<string>() {"abababababa","abababjdvdhg","hfjhdsfqwtw8yqfjref","jegiuigwerhti"};
ViewBag.Texts = lists;
return View();
}