Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
jquery-text-counter
Advanced tools
Readme
A jQuery plugin for counting and limiting characters/words on text input, or textarea, elements.
Include script after the jQuery library:
<script src="/path/to/textcounter.min.js"></script>
or
Install using npm:
npm install jquery-text-counter
or
Install using bower:
bower install jquery-text-counter
Basic usage (view editable code):
$('input').textcounter();
Define maximum words and allow further input (view editable code):
$('input').textcounter({
type: "word",
max: 15,
stopInputAtMaximum: false
});
Define minimum characters and set custom countDownText
(view editable code):
$('input').textcounter({
min: 20,
countDownText: "%d characters remaining"
});
By default the plugin creates and appends the following element after the input:
<div class="text-count-wrapper">
Total Count:
<span class="text-count">0</span>
</div>
If an error is present it is appended within the element. The input gains the inputErrorClass
and count wrapper gains the counterErrorClass
as defined in the options:
<input name="sample" class="error" />
<div class="text-count-wrapper error">
Total Count:
<span class="text-count">0</span>
<div class="error-text">Error message text</div>
</div>
Fires when a counter reaches the maximum word/character count.
Fires when a counter reaches the minimum word/character count.
Fires after the counter is initialized.
Fires when counter is under max limit.
Fires when counter is under min limit.
type : "character", // "character" or "word"
min : 0, // minimum number of characters/words
max : 200, // maximum number of characters/words, -1 for unlimited, 'auto' to use maxlength attribute, , 'autocustom' to use a custom attribute for the length (must set "autoCustomAttr")
autoCustomAttr : "counterlimit", // custom attribute name with the counter limit if the max is 'autocustom'
countContainerElement : "div", // HTML element to wrap the text count in
countContainerClass : "text-count-wrapper", // class applied to the countContainerElement
textCountMessageClass : "text-count-message", // class applied to the counter message
textCountClass : "text-count", // class applied to the counter length (the count number)
inputErrorClass : "error", // error class appended to the input element if error occurs
counterErrorClass : "error", // error class appended to the countContainerElement if error occurs
counterText : "Total Count: %d", // counter text
errorTextElement : "div", // error text element
minimumErrorText : "Minimum not met", // error message for minimum not met,
maximumErrorText : "Maximum exceeded", // error message for maximum range exceeded,
displayErrorText : true, // display error text messages for minimum/maximum values
stopInputAtMaximum : true, // stop further text input if maximum reached
countSpaces : false, // count spaces as character (only for "character" type)
countDown : false, // if the counter should deduct from maximum characters/words rather than counting up
countDownText : "Remaining: %d", // count down text
countExtendedCharacters : false, // count extended UTF-8 characters as 2 bytes (such as Chinese characters)
twoCharCarriageReturn : false, // count carriage returns/newlines as 2 characters
countOverflow : false, // display text overflow element
countOverflowText : "Maximum %type exceeded by %d", // count overflow text
countOverflowContainerClass : "text-count-overflow-wrapper", // class applied to the count overflow wrapper
minDisplayCutoff : -1, // maximum number of characters/words above the minimum to display a count
maxDisplayCutoff : -1, // maximum number of characters/words below the maximum to display a count
// Callback API
maxunder : function(el){}, // Callback: function(element) - Fires when counter is under max limit
minunder : function(el){}, // Callback: function(element) - Fires when counter is under min limit
maxcount : function(el){}, // Callback: function(element) - Fires when the counter hits the maximum word/character count
mincount : function(el){}, // Callback: function(element) - Fires when the counter hits the minimum word/character count
init : function(el){} // Callback: function(element) - Fires after the counter is initially setup
stopInputAtMaximum
with twoCharCarriageReturn
count fix, trimmed newline calculation fix, maximum text reached condition fix, text count overflow notificationminDisplayCutoff
and maxDisplayCutoff
optionsFAQs
jQuery plugin to count text/characters in a textarea or input. Allows error notifications on minimum or maximum number of characters/words.
The npm package jquery-text-counter receives a total of 386 weekly downloads. As such, jquery-text-counter popularity was classified as not popular.
We found that jquery-text-counter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.