How to open the number pad in a formatted field?

Asked

Viewed 1,729 times

0

I have a text field that receives the CPF, it has a CPF mask, but as it is a text field, in Mobile it does not open directly on that number pad and when I change its type to number, it only writes the first 3 digits and erases everything when it arrives at "." field formatting.

<html>
    <div class="form-separador">
        <input type="text"  class="input1"  id="cpf" name="cpf"
               placeholder="000.000.000-00" value="%%=v(@Cpf)=%%" required >
    </div>
</html>

$(document).ready(function(){
  $('#cpf').mask('000.000.000-00', {reverse: true});
});

1 answer

1


Upgrade the maskinput version to version 1.4. Add type="tel" and remove the maxlength attribute from the input or set it to a certain value so it doesn’t interfere with the cursor action, like 20.

Source: https://stackoverflow.com/a/29437478/4312593

  • I changed the input type "input type="tel"" in HTML, as I said. That way, it started accepting digits as "." or "-" and still opens directly the numeric field. Thanks!!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.