I want to simulate the highlight action on selected text when i double click on the text, but with just a single click event. How can i do it? I tried with these code but fail
handleOnClick(event) {
event.preventDefault();
//i thought this suppose to trigger double click event
//and highlight the text under the mouse cursor
event.target.dispatchEvent(new MouseEvent('dblclick', {bubbles:true}));
//...
}
Do you need the whole div element or just some part of it? Here's a solution to highlight the whole div on double click event.