You could also do it with non-styling classes, as an alternative to
locating them.
$('div:first').data('foo', 'bar').addClass('foo');
$('.foo');
On Jul 28, 3:15 pm, Basdub <[email protected]> wrote:
> Thanks, that should do the trick.
>
> On Jul 23, 10:44 pm, Karl Swedberg <[email protected]> wrote:
>
>
>
> > One way to retrieve them is to use the .filter() method with a
> > function. for example:
>
> > $('div').filter(function() {
> > return $(this).data('foo') == 'bar';
>
> > });
>
> > --Karl
>
> > ____________
> > Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> > On Jul 21, 2009, at 11:29 AM, Basdub wrote:
>
> > > I wanted to define additional attribute to a tag to manage
> > > information. I realized that XHTML might not like it and discovered
> > > the data(name,value) function.
>
> > > I was wondering how i could retrieve all tags e.g. "div" that have
> > > that data variable set.