I would like to copy text in the input field but without highlighting selected text. Below is the code snippet,
click = () => {
this.input_ref.current.select();
document.execCommand('copy');
};
<input readOnly ref={this.input_ref} value="hello"/>
<button onClick={this.click}>COPY</button>
I have tried add css to input field as below but did not work.
.no_select {
-webkit-tap-highlight-color: transparent;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
outline: none;
}
<input classname="no_select" readOnly ref={this.input_ref} value="hello"/>
Could someone help me with this. thanks.