Skip to content

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