Per Chris's suggestion, I've made an update to the plugin. Now, you
can specify that the container be an existing DOM element (e.g,
"#myContainer") or an element type that will be created and inserted
in the DOM directly after the textarea (e.g., "<em>"). If nothing is
specified, a <span> element will be created and inserted.

When specifying a container element by ID, the "classname" option is
not applied to the element.

I've got a slightly ugly bit of code where I check to see if the user
has specified an existing element by ID for the container. I'd
appreciate suggestions for cleaning this up:

var container = (options.container.indexOf("#") == 0) ? $
(options.container) : $
(options.container).insertAfter(this).addClass(options.classname);

On May 8, 1:00 pm, "Chris W. Parker" <[EMAIL PROTECTED]> wrote:
>
> Great!
>
> Comment:
>
> I think you should change the 'container' option into a more flexible
> 'attachTo' option.
>
> It would work like this:
>
> <html>
>
>         <form>
>                 <textarea id="text1" ...></textarea>
>                 <div id="count_text1"></div>
>         </form>
>
> </html>
>
> $("textarea").charCounter(100, {
>         attachTo: "#count_text1",
>         className: "counter"
>
> });
>
> Chris.

Reply via email to