Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery inputmask no limit on number of characters

I'm using the jQuery inputmask plugin for masking a text field (https://github.com/RobinHerbots/Inputmask). I can't figure out the syntax for masking an unlimited number of alphanumeric characters. This seems like it should be simple I just can't seem to find the answer in in the documentation or another stackoverflow question. So far this works:

$('.inputmask_alphanumeric').inputmask({ mask: "[*]{100}", greedy: false });

{100} is a generous number for now, but I want this to be a generic class rule for any long text input in the future. I tried {*} and {+} but they didn't seem to work. Thanks.

like image 907
wzsmith1 Avatar asked Dec 01 '16 23:12

wzsmith1


People also ask

How to set Max character count in jQuery?

1. Insert the minified version of the jQuery MaxLength plugin after you've loaded jQuery library. 2. Attach the plugin to the text field and specify the maximum number of characters using the native HTML maxlength attribute. ... 3. Create an element to hold the current character count.

How to limit the number of characters in a text field?

limitText.js is a small (2kb minified) jQuery plugin that limits the number of characters allowed in your text fields and automatically creates counters to display how many characters remaining. Compatible with Bootstrap framework. Supports both input field and textarea. 1. Create a character counter container on the web page.

How to restrict input fields to numbers only in jQuery?

1. Import the jQuery jQuery Key Restrictions plugin into your document which has jQuery library loaded. 2. Restrict an input field to letters only. 3. Restrict an input field to numbers only. 4. Restrict an input field to Alpha Numeric only. This awesome jQuery plugin is developed by kenryanlabso.

What is maxLength in jQuery?

MaxLength is a lightweight (less than 1kb) jQuery plugin to limit the number of characters allowed to type in an input field or textarea element. Prevents typing when reaching the limit. Character counter and countdown. Custom user feedback when reaching the limit. Works with the native HTML maxlength attribute. 1.


Video Answer


1 Answers

  • [] optional
  • () group
  • {} range

[*]{100} == Optional char * must be entered 100 times

You need *{0,} to create a min:0 and max:infinite mask

Or {1,} to create a min:1 and max:infinite

and so on :)

like image 145
greenseed Avatar answered Oct 05 '22 09:10

greenseed