Or you could just do this:

$(':input,:checkbox,:radio').addClass('YOUR_CLASSNAME');


On Jun 1, 10:24 am, waseem sabjee <waseemsab...@gmail.com> wrote:
> <script>
> $(function() {
>
> var myforms = $("form");
>
> myforms.each(function(i) {
>
> var myform = myforms.eq(i);
>
> var myfields = $("input", myform);
>
> myfields.each(function(i) {
>
> var myfield = myfields.eq(i);
>
> myfield.addClass("myflied_"+i);
>
> });
> });
> });
>
> </script>
>
> On Mon, Jun 1, 2009 at 7:19 PM, Loony2nz <loony...@gmail.com> wrote:
>
> > Hey everyone,
>
> > I need help with a jquery task.
>
> > I have a form that has it's HTML inserted into the database (yeah yeah
> > I know..not my idea..I'm new here and just finding this out).
>
> > Anyway, each form field has an embedded class in the HTML.
>
> > The form is dynamically generated.  Can be anywhere from 5 to 10 to 20
> > to 50 fields.
>
> > How can I loop over each form field and add a new class to the field
> > (either input or radio or checkbox)?
>
> > Thoughts?
>
> > Thanks!

Reply via email to