Answers for "how to limit characters in number input js"

0

limit characters display javascript

var str = 'Some very long string';
if(str.length > 10) str = str.substring(0,10);
Posted by: Guest on January-05-2021
0

how to limit characters in number input js

function limit(element)
{
    var max_chars = 2;

    if(element.value.length > max_chars) {
        element.value = element.value.substr(0, max_chars);
    }
}


<!-- HTML -->
<input type="number" onkeydown="limit(this);" onkeyup="limit(this);">
Posted by: Guest on April-27-2020
0

how to limit characters in number input js

function limit(element)
{
    var max_chars = 2;

    if(element.value.length > max_chars) {
        element.value = element.value.substr(0, max_chars);
    }
}
Posted by: Guest on June-11-2021

Code answers related to "how to limit characters in number input js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language