On 5/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
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:
Why not do:
var container = ($(options.container).parent().size() == 1) ?
$(options.container) :
$(options.container).insertAfter(this).addClass(options.classname);
You're not limited to just the id selector then.
-js
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.