Currently, I am working with Angular2 and have incorporated a div element to display multiple lines of text. Positioned below the text is a button that, when clicked, should select the entirety of the text within the div (similar to selecting text manually where it becomes highlighted in blue). Below is a snippet of my HTML:
<div #ins class="xyz" innerHTML="{{ 'sometext' | translate }}"></div>
I've attempted creating a CSS class with a background-color property set to 'blue' and applying it to the entire div upon clicking the button. However, this approach results in the entire div turning blue. My goal is to only highlight the text portion with a blue background, just as it appears when selected manually. Is there a way to achieve this effect?