$(‘div.someClass:width(>500)’).remove();
I’ve noticed that IE7 appears to ignore the class selector and iterates though every DIV checking the width. Chrome & FF work fine. I fixed it by doing this…
$(‘div.someClass’).filter(‘:width(>500)’).remove();
Did I do something wrong?
]]>Also your examples of using the ‘data’ function opened up my eyes to some possibilities.
]]>$(':data').each( function() { console.info( $(this).data() ); } ) |
case ‘~’: // regular expression
exp = querySplitted[1].substr(1,querySplitted[1].lastIndexOf(‘/’)-1);
modif = querySplitted[1].substr(querySplitted[1].lastIndexOf(‘/’)+1)
re = new RegExp( exp, modif);
return re.test(checkAgainst);
break;
$('elem').data('foo', {bar:'el', baz:{a:2, b:'hai'}, bla:'x'}); |
So I decided to write my own selector which allows for querying like this:
$('elem:data("foo.baz.b=hai")'); |
It does not support regexes like yours, however you can do ^= $= != *= like the attribute selectors.
You can have a look at the sourcecode here.
Thanks for the article as this was the article that thought me how to write :selectors in the first place. And inspired me how to create the selector.
]]>I just started using jquery in earnest in the last two weeks or so. I keep getting fascinated by the power of this lib.
I didn’t know it was so easy to extend the selectors. I came here searching with Google for a way to select elements with a certain. Like “find all divs with background-color: red”.
That is not AFAIK possible with jquery out of the box, but it seems to be simple to create such a selector!
Thanks a million!
]]>