Giter Site home page Giter Site logo

aaronrussell / jquery-simply-countable Goto Github PK

View Code? Open in Web Editor NEW
205.0 205.0 76.0 308 KB

jQuery plugin that provides a character counter for any text input or textarea.

Home Page: http://github.com/aaronrussell/jquery-simply-countable/

JavaScript 100.00%

jquery-simply-countable's People

Contributors

aaronrussell avatar ryanwood 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

jquery-simply-countable's Issues

jQuery 2.0 Support

Could this be updated for jQuery 2.0? Or, tell me what I need to look for to enable compatibility?

counter doesn't update when control text is set using javascript

Currently, the counter only updates on keyup, blur, or paste events.
So when you set the value using javascript, the counter doesn't change.
My current workaround is to manually trigger a "blur" event after setting the value....

$('#myTextarea').val("some text"); // counter doesn't update
$('#myTextarea'),blur(); // make counter recognize text change

I'm not sure if there's an easy solution to this issue that will work with all browsers, but I think it should be a future enhancement if it is possible.

Position of the count

hello,
I would like to know how to change the position of the countable because I would like to have this on the bottom of my text area.
Thanks

Newline breaks word count

After fixing demo.html to count words on #demo2 (see issue 7), I tried to test. This value correctly counts 11 words:

one two 3  four five.     6666. seven. eight. nine. 10. eleven.

However, this value only counts 10:

one two 3  four five.     6666.
seven. eight. nine. 10. eleven.

I believe the default value for wordSeparator should be '\s' (any white space). This means the strictMax truncation would have to be modified to maintain the original white space up to maxCount.

Does it work within a div?

Hello,

I'm trying to make this work with a WYSIWYG editor like Redactor.
Does this plugin counts chars inside a div as well? Or only text areas and input fields?

Thanks in advance.

demo.html #demo2 counts chars

In demo.html, characters are being counted for #demo2 instead of words:

$('#demo2').simplyCountable({
  counter: '#counter2',
  countType: 'characters',
  maxCount: 10,
  countDirection: 'up'
});

How to get counter to reset after submit (ajax)

I have a form thats submitted with ajax, and the counter shows the remaining characters (if any) and won't update until a user starts typing again. Any way to reset the count on submit?

Fire onMaxCount callback only once

I would like to append some alert text to the DOM after the user reaches the Max word count. I'm using strictMax: true and the onMaxCount callback function.

The alert text is continually being appended when the keyboard is pressed. How can I have this text append only once?

Whitespaces at the end

Hi!

Is it possible to restrict the input of whitespaces if the counter exceeds the maxCount figure? โ€“ ATM there is only a restriction for characters/numbers but not for whitespaces.

Thanks a lot and best regards! โ€“ sokai

Safe/Over Class & onSafeCount not working with strictMax set to true.

Safe/Over Class & onSafeCount not working with strictMax set to true.

My Code:

 $(this).simplyCountable({
      counter: $msgElem,
      countType: 'words',
      maxCount: 5,
      strictMax: true,
      safeClass: 'is--safe',
      overClass: 'is--over',
      countDirection: 'down',
      onSafeCount: function(count, countable, counter){
           console.log('safe');
      },
 });

Multiple count modes

Hi,

Would be great if the plugin supported both character and word modes. I will see if I can fork it and push the change, but for now am on a tight deadline. :-)

Regards,

Kobus

Modal windows

I find that this doesn't work within model windows and i have a suspicion its todo with the fact you're not using the jquery .live() function as some modals alter DOM objects after page load.

Ability to use data attributes on element

Can you please add the ability to use data attributes on the element ( input or textarea ) ?
It's really very helpfull to get working the plugin juste using the data attributes.
Ex : data-maxCount ...

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.