You could try to (almost instantly) remove the selection when someone selects something inside the input element with .getSelection().removeAllRanges();
.
It is still possible to copy the text if someone is quick.
$("input").select(function() {
window.getSelection().removeAllRanges();
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="number" value="123">
You can improve this by making it look like text is not selectable (see Samuel's answer), I added it into an extra code snippet:
$("input").select(function() {
window.getSelection().removeAllRanges();
});
input::selection {
background-color:transparent;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="number" value="123">
After all of this you can also make it imposible for the user to copy anything inside an input field by adding onCopy="return false"
to the input field. (It is still selectable but not possible to copy).
<input type="number" value="123" onselectstart="return false" oncopy="return false;" />
You might only want to use 1 or a combination of 2 of those things inside your project. Combine the things you need and you can make an unselectable/uncopy-able input field.
You can also disable cutting/pasting or right clicking according to this article.