2 Replies - 606 Views - Last Post: 12 April 2010 - 08:03 AM

#1 gregwhitworth  Icon User is offline

  • Tired.
  • member icon

Reputation: 219
  • View blog
  • Posts: 1,605
  • Joined: 20-January 09

Grab all objects with a certain class and then do...

Posted 10 April 2010 - 04:58 PM

Ok. So I'm writing a jQuery plugin and want to know how to grab every object with a certain class name and then do something with them. Does this make sense.

For instance:

<div class="red"></div>



Then that would call a jquery function that would automatically add extra divs and really whatever I want. The rest I know how to do, I just don't know how to call them. Thanks.

--

Greg

Is This A Good Question/Topic? 0
  • +

Replies To: Grab all objects with a certain class and then do...

#2 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1199
  • View blog
  • Posts: 7,308
  • Joined: 07-September 06

Re: Grab all objects with a certain class and then do...

Posted 11 April 2010 - 10:24 AM

In jQuery, I believe it is $(".className").function call. At which point I believe you want to do something like so:
$(".red").append("Additional HTML here.");



Sorry, I am not a jQuery person, but I do know some of their syntax.

Hope that helps.
Was This Post Helpful? 1
  • +
  • -

#3 gregwhitworth  Icon User is offline

  • Tired.
  • member icon

Reputation: 219
  • View blog
  • Posts: 1,605
  • Joined: 20-January 09

Re: Grab all objects with a certain class and then do...

Posted 12 April 2010 - 08:03 AM

Thanks for the help beta, that wasn't what I was looking for but it did help me in the long run. I was actually making it more difficult than it needed to be, I was wondering how to get the value of the class that was typed in by the user, when I can merely use $(this).

Thanks.

--

Greg
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1