Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
I don’t know, maybe it was moved somewhere with the new UIElements and renamed, but the general principle is to look at the documentation
https://docs.unity3d.com/2019.1/Documentation/Scri... with a
script to check and cut off unnecessary characters.
Intercept changes to the input field and remove unnecessary characters from there.
The simplest (codes of letters in the asci table):
<script language="JavaScript" type="text/javascript">
$(document).ready(function(){
$('.prices').keypress(function(e) {
if (!(e.which==8 || e.which==44 ||e.which==45 ||e.which==46 ||(e.which>47 && e.which<58))) return false;
});
});
</script>
<input type="text" id="input"/>
<script>
input = document.getElementById('input')
input.onkeyup = function(){this.value = this.value.replace(/[^0-9\.]/g,'')}
</script>
<script>
function validate(inp) {
inp.value = inp.value.replace(/[^\d,.]*/g, '')
.replace(/([,.])[,.]+/g, '$1')
.replace(/^[^\d]*(\d+([.,]\d{0,5})?).*$/g, '$1');
}
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question