Hi Felix,

I would have thought doing an attribute selector like you suggest was
better.

something like

...
$('.qualif[level]).each ....
...

to at least get rid of anything that doesn't have the level attribute.
Also if you use the same tag name for all of these attributes its
worth adding that as it also helps with efficiency, i.e. jquery only
has to check those tags for level attribute.

Depending on the exact use of the level attribute you might be able to
get just the ones you want by using [attribute!=value] selectors. i.e.
if you want greater than 4 and start at 0

$('.qualif[level!=0], .qualif[level!=1], .qualif[level!
=2], .qualif[level!=3], qualif[level!=4]').remove();

Hope that helps. Also if any more expert on jquery knows more am keen
to know better also.

Cheers,
Pete

On Jan 30, 12:56 pm, Feijó <[EMAIL PROTECTED]> wrote:
> Hi,
> I was just wondering if there is any better way to accomplish that.
> Some divs has 'level' attribute, with a number.  If that number is bigger 
> than X, will remove the div.
>                 var x=4; // simulating
>                 level=parseFloat($this.attr('level'));
>                 $('.qualif').each(function() {
>                     if ($(this).attr('level')>x)
>                         $(this).remove();
>                 });
> I don't know if we can set a filter in $('') to look at a custom attribute, 
> should be simpler than
> Feijó

Reply via email to