
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Maska is a lightweight JavaScript library for input masking. It allows you to format user input in real-time, ensuring that the data entered matches a specified pattern. This is particularly useful for forms that require specific formats, such as phone numbers, dates, and credit card numbers.
Basic Masking
This feature allows you to apply a basic mask to an input field. In this example, the input field with the id 'phone' will be formatted as a US phone number.
const input = document.querySelector('#phone');
Maska.create(input, { mask: '(###) ###-####' });
Dynamic Masking
This feature allows you to apply a dynamic mask to an input field. In this example, the input field with the id 'date' will be formatted as a date in the format MM/DD/YYYY.
const input = document.querySelector('#date');
Maska.create(input, { mask: '##/##/####' });
Custom Placeholders
This feature allows you to use custom placeholders in your masks. In this example, the input field with the id 'custom' will be formatted as a credit card number with 'X' as the placeholder.
const input = document.querySelector('#custom');
Maska.create(input, { mask: '####-####-####-####', placeholder: 'X' });
Inputmask is a JavaScript library that creates an input mask. Inputmask can run against vanilla JavaScript, jQuery, and jqlite. It is more feature-rich compared to Maska, offering a wide range of options for different types of input masks, including numeric, date, and regex-based masks.
Cleave.js is a JavaScript library for formatting input text content when you are typing. It offers a variety of formatting options, including credit card numbers, phone numbers, dates, and numeral formatting. Cleave.js is similar to Maska but provides more advanced formatting options and better support for different locales.
Vanilla Text Mask is a pure JavaScript input mask library. It works with vanilla JavaScript and also has integrations for React, Angular, and Vue. It is similar to Maska in terms of functionality but offers more flexibility and integration options with modern JavaScript frameworks.
Simple zero-dependency input mask.
❤️ Please support Maska development!
FAQs
Simple zero-dependency input mask for Vanilla JS, Vue, Alpine.js and Svelte
The npm package maska receives a total of 162,019 weekly downloads. As such, maska popularity was classified as popular.
We found that maska demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.