On May 28, 6:00 am, Fountain Internet <sijones...@googlemail.com>
wrote:
> I think you misunderstand what I'm trying to do. The plugin
> automatically inserts the second label - what I was trying to do was
> get it to use a <span> instead of a <label>, preferably without
> forking the code.
>
> On May 27, 8:24 pm, waseem sabjee <waseemsab...@gmail.com> wrote:
>
> > you don't need a plugin to do this for you. its just unnecessary memory
> > usage.
>
> > all you would need to do is
>
> > first add a class to your <p> tag
>
> > like <p class="one">
>
> > then the script
>
> > $("p.one").append('<span class="error">My Error<\/span>'):
>
> > On Wed, May 27, 2009 at 8:22 PM, Fountain Internet <sijones.uk@
>
> > googlemail.com> wrote:
>
> > > ok, here's a snippet of my HTML:
>
> > > <p>
> > >        <label for="txtName">Name: <span class="requiredField">*</span></
> > > label> <br />
> > >        <input type="text" id="txtName" name="txtName" />
> > > </p>
>
> > > I adapted the Remember The Milk example code to validate my fields.
> > > For the above field the resulting markup becomes:
>
> > > <p>
> > >        <label for="txtName">Name: <span class="requiredField">*</span></
> > > label> <br />
> > >        <input type="text" id="txtName" name="txtName" />
> > >        <label class="error" for="txtName" generated="true">Please enter
> > > your
> > > name</label>
> > > </p>
>
> > > i.e. two labels associated with one field. I want the generated
> > > <label> (i.e. the second <label>) to be a <span> instead. One of the
> > > plugin examples seems to do what I want (example.html) but when I
> > > tried to use the code in my own page, it continued to output <label>
> > > instead of <span> tags. I'd prefer not to fork the core code.

Hi there,

The validation plugin makes provision for customising the element used
to display error messages. You specify the element required as an
option paramater during the initial validate call: see
www.docs.jquery.com/Plugins/Validation/validate#options

so eg: $(#someForm).validate({
         errorElement: "span"
});

I wouldn't recommend editing the plugin as you will lose all your
changes when an upgrade becomes available.

Hope this helps!!


Reply via email to