Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

counter can now be a jquery object #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thatandyrose
Copy link

What is this?

This PR enables the user to pass a jQuery object as a counter: in the options parameter.

Why would you want to do that?

If you're dynamically creating multiple textareas on the page, then you can have all your counter elements have the same selector. You just pass in each specific element when you're initiating each textarea manually. For example:

$(document).ready(function(){
  $('textarea').each(function(){
   var counter = $(this).closest('.textarea-container').find('.counter');
    $(this).simplyCountable({counter: counter});
  });
});

@GarrettAlbright
Copy link

This would be useful for me. It seemed kind of silly that I had to concatenate strings to build a selector to a jQuery object that I already have in a variable.

@thatandyrose
Copy link
Author

@GarrettAlbright agreed... But not sure it's gonna get merged in...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants