Giter Site home page Giter Site logo

jquery-text-counter's People

Contributors

ameshkin avatar diptopol avatar goranmiric avatar hexodus avatar konnng-dev avatar ractoon avatar stgeneral avatar t3mujin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

jquery-text-counter's Issues

$base used instead of base, causes error path to fail

I think this is just a typo, but the base.setErrors on line 165 references $base instead of base, which causes an error (when there's an error). I think it's meant to be just "base" though when I did that, it caused another error so not sure I have a working PR to file yet. errorText is also not initialized as a variable in that block, causing problems in a strict/bundled environment about it not being strictly defined.

Word countdown incorrect

When you set the type to Word and use the countdown it shows 1 remaining but after typing a space to then start to type the last word it prevents you from typing the last word and shows 1 remaining again.

Config used:

$(".sample").textcounter({
type: "word",
stopInputAtMaximum: true,
countDown: true,
countDownText: "Words Remaining: %d",
max: 250
});

If you enter 249 words it will show 1 remaining. You then press "space" (which it allows) and as soon as you type a character it will delete the character(s) typed along with the space and display Words Remaining: 1 again.

Execute after Keyup event?

is there any way to make this work without the "live" option? In other words - if I only wanted to count the number of occurrences AFTER I used a selector like a search button?

Thanks!

Add position option for counterText

Hi. Would it be possible to add a position option for the counter text so I don't have to force move it with a float in CSS?

Example

$('.comments textarea').textcounter({
  counterText: ' characters',
  counterPosition: 'after'
});

would make it read 0 characters instead of Total Count: 0.

Thanks in advance!

Incorrect text count for new line

If stopInputAtMaximum is set true and we try to insert more character than max limit, plugin will trim the text. For twoCharCarriageReturn option true, if we add a newline which exceeds max limit, plugin will trim but total text count do not decrease by 2.

Multiple Textareas.

Hello there,

How can I use it for multiple textareas?

~ One counter for multiple textareas

Thanks!

Line Breaks Counting

Is there an easy way to count line breaks as 2 characters?
I checked the unminified version but could´t find the right spot to make custom changes.

Thank you!

Accessibility - Count down

When typing screen reader doesn't announce the number of character remaining, and that represents an accessibility issue.

Thanks for the brilliant Plugin

Wow this is an awesome great plugin! I have looked at several plugins but no one does support min and max (=between) at the same time, your does as the only one. And your plugin has callbacks, great! Thanks so much for this absolutely brilliant plugin! (Ticket can be closed)

Double Counters

Is there any reason why I got double counters under one input element?

wysiwyg editor compatibility

I would like to use your jQuery text counter with a WYSIWYG text editor in a textarea. Is there an editor you recommend that is compatible with your word counter. I need it to be able to paste from MS Word.
Thanks

Counter starts at 99 instead of 100?

Hi there,

Love the plugin, im encountering an error where it starts at 99 instead of 100? Here is my code:

$(this).textcounter({
type: "word",
min : 0,
max: 100,
countDown: true,
countDownText: "Words Remaining: ",
stopInputAtMaximum: false
});

multiple instances of JQuery Text counter in a form

Is it possible to have multiple instances of the text counter with different maximum word counts on a form with multiple text areas? If so, how would I do that? I have 8 text areas on one form that need word limits.

position before

Hello
How position message "before" a long textarea (nobody see after textarea).
Thanks
Ami

Option to count new line for 2 chars?

The plugin seems to count a new line for 2 chars but soustract only one in the display (if the "countDown" option is set to true). As I've set the "stopInputAtMaximum" option to true, the result is that the user can't type any more text but the message shows that he can type more.

Doesn't work with TinyMCE

Doesn't work with TinyMCE (https://www.tinymce.com)

Here's a rather hacky fix:

  • Add a hidden textarea
  • Apply text counter to the hidden textarea
  • Add to you TinyMCE:
setup : function(ed)    {           
    ed.on('keyup', function(e) {
        var content = tinyMCE.activeEditor.getContent({format : 'text'});
        $(".hidden-mce").val(content).change();
    });
}

Issue with trimmed text length calculation

If stopInputAtMaximum option is true and twoCharCarriageReturn option is true, trimmed text calculation does not consider twoCharCarriageReturn value. As a result, if text contains new lines, user will able to insert extra characters after reaching the max value.

Added a pull request. #29

Issue in text count for countSpaces false option

For countSpaces false option, plugin will detect number of space based on regex. But the regex will match a space, a tab, a line break, or a form feed. So there will be no text count increase if user insert a new line in text area. I am not sure whether the regex check is intentional or not. In my opinion this issue should be fixed. I have done the code to fix the issue. But I want to know everyone's thought on that.

New version not working

Thank you for the plugin.
The example on jsfiddle no longer works with the new version, it seems like there is a problem with counting down text.

Disable/Enable buttons

Hi guys, love the code here but very newb question here. Is there a way to disable a button when the textarea text/word count goes over the maximum or re-enable it when it's under the text/word count?

I can easily do this using ('#UpdateButton').prop('disabled', true); in my code but not whilst using your text counter.

As I say, newb question here.

Cheers

Compatibility with Webpack

I'm trying to build my front end assets with Webpack. However, I'm getting the following error

TypeError: $(...).textcounter is not a function

Is this because this the text counter uses it's own jQuery? I'm initialising it as follows:

$(document).ready(function()
{
	$('.text-counter').textcounter(
		{
			countDown: true,
			type: 'word',
			max: 200,
			stopInputAtMaximum: true,
			displayErrorText: true,
			maximumErrorText: 'Max. words reached'
		});
});

Any suggestions welcome. Thanks

Thanks!

This is working great!

Thank you!

Not showing count for Chinese words

I have used this plugin and works great for English words. But it doesn't work for Chinese words even I set "countExtendedCharacters " to true.

$('#description').textcounter({
max: 200,
countDownText: "Characters Left: ",
countExtendedCharacters : true,
type : "word",
});

Update text-count-message div to aria-label="polite" instead of assertive

hello there,

Your text counter is widely used so we thought we would ask you to update the code base regarding aria-label="assertive"

placed on the text-count-message div character count. Our users feel as if this should be set to polite. We wanted to first ask you to perhaps make this change, before forking your repo. It is very annoying that the character count is repeated as a blind user types.

https://github.com/search?q=repo%3Aractoon%2FjQuery-Text-Counter+assertive+live&type=code

A11y: Voiceover and programmatic association

textcounter is used on our site and works well - thank you! We have encountered the following issues:

  1. Garbled announcements by Voiceover, particularly on MacOS
  2. When a screen reader interacts with a field, they have no way of determining that there is counter text associated to that field. They will hear the text when reading the page in general but not when investigating the control.

I forked the project to make the changes to our site - the PR in case you would like to integrate them into the main trunk: #54

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.