Dynamically assign max-width after rendering the element on the page