so I want to use this JQuery plugin that Stack Overflow has made available to me :)
Auto-size dynamic text to fill fixed size container
However, I need to use this on an HTML element that is dynamically created server side. Example,
I create all the elements, convert them to HTML, and then return them as an array of Json strings basically (in HTML form) to the front end:
public JsonResult GetMessages()
{
// do conversion work
List<string> htmlMessages = new List<string>();
foreach(Message message in this.messages)
{
htmlMessages.Add(message.toHTML());
}
return Json(htmlMessages);
}
And then on the front end I append them to a div
in Jquery like this:
// make my AJAX call
// in the success method I do this
for (var i = 0; i < data.length; i++)
{
$('#containerDiv').append(data[i]);
}
Now this works fine but how would I then call the JQuery plugin on each of these elements that's appended to format the text size within one of the divs
in the element?