[jQuery] Re: Attribute selector
Hello! On Wed, Mar 25, 2009 at 6:00 PM, Karl Swedberg k...@englishrules.com wrote: Hi Lay, You could do it like this: $('table').filter(function() { return this.style.tableLayout == 'fixed'; }); Not sure what happens when you try it in a browser that doesn't support the tableLayout property, though. Yes, this way works: $('table').filter(function() { return this.style.tableLayout=='fixed'; }).css('background-color','#DD'); Thank you! Bye! Lay
[jQuery] Re: Attribute selector
Hi Lay, You could do it like this: $('table').filter(function() { return this.style.tableLayout == 'fixed'; }); Not sure what happens when you try it in a browser that doesn't support the tableLayout property, though. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 25, 2009, at 10:28 AM, Lay András wrote: Hello! I'd like to set a css property on every table, that have style=table-layout: fixed attribute. I tried this, but don't works: $('table[style=table-layout: fixed]').css('background- color','#DD'); With id attribute works: $('table[id=mytable]').css('background-color','#DD'); But i don't want to add id-s in tables. How can i solve this like first example? Thanks you! Lay
[jQuery] Re: attribute selector: evaluating to variable
Hi Manuel, You have to concatenate the rest of the selector, which is a string, and the variable: $('.removeFav[adld=' + adId + ']').show(); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 23, 2009, at 10:44 AM, aldana wrote: hi, how do i let a variable evaluate inside an attribute selector: var adId=$(this).attr(adId); //i want adId to be evaluated and not compare directly to 'adId' string $('.removeFav[adId=adId]').show(); thanks. - manuel aldana aldana((at))gmx.de software-engineering blog: http://www.aldana-online.de -- View this message in context: http://www.nabble.com/attribute-selector%3A-evaluating-to-variable-tp21626781s27240p21626781.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: attribute selector: evaluating to variable
sorry, of course... did look too much at it to see the most obvious solution. Karl Swedberg-2 wrote: Hi Manuel, You have to concatenate the rest of the selector, which is a string, and the variable: $('.removeFav[adld=' + adId + ']').show(); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 23, 2009, at 10:44 AM, aldana wrote: hi, how do i let a variable evaluate inside an attribute selector: var adId=$(this).attr(adId); //i want adId to be evaluated and not compare directly to 'adId' string $('.removeFav[adId=adId]').show(); thanks. - manuel aldana aldana((at))gmx.de software-engineering blog: http://www.aldana-online.de -- View this message in context: http://www.nabble.com/attribute-selector%3A-evaluating-to-variable-tp21626781s27240p21626781.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. - manuel aldana aldana((at))gmx.de software-engineering blog: http://www.aldana-online.de -- View this message in context: http://www.nabble.com/attribute-selector%3A-evaluating-to-variable-tp21626781s27240p21627604.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Attribute selector with namespace
Thanks. I will need to apply that tiny patch. Brian J. Cardiff bcardiff(?)gmail.com . On Sun, Nov 9, 2008 at 10:02 AM, Balazs Endresz [EMAIL PROTECTED]wrote: There's a ticket on this issue: http://dev.jquery.com/ticket/3023 On Nov 7, 11:48 pm, Brian J. Cardiff [EMAIL PROTECTED] wrote: thanks but that it isn't working in this scenario for: span x:foo=barLorem/span the expression: $('span').filter(function(){return $(this).attr(x:foo);}) returns the span element but neither: $('[x:foo]') no: $('[x\\:foo]') find it any clue? Brian J. Cardiff bcardiff(?)gmail.com . On Fri, Nov 7, 2008 at 6:11 PM, MorningZ [EMAIL PROTECTED] wrote: http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_. .. On Nov 7, 2:06 pm, Brian J. Cardiff [EMAIL PROTECTED] wrote: Is there a way to specify an AttributeFilter for attributes within a certain namespace? I try some alternatives but it seems that is not implemented. For example: span x:foo=barLorem/span I would need that something like $('[x:foo]') find the span element. Thanks. Brian J. Cardiff bcardiff(?)gmail.com .
[jQuery] Re: Attribute selector with namespace
There's a ticket on this issue: http://dev.jquery.com/ticket/3023 On Nov 7, 11:48 pm, Brian J. Cardiff [EMAIL PROTECTED] wrote: thanks but that it isn't working in this scenario for: span x:foo=barLorem/span the expression: $('span').filter(function(){return $(this).attr(x:foo);}) returns the span element but neither: $('[x:foo]') no: $('[x\\:foo]') find it any clue? Brian J. Cardiff bcardiff(?)gmail.com . On Fri, Nov 7, 2008 at 6:11 PM, MorningZ [EMAIL PROTECTED] wrote: http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_... On Nov 7, 2:06 pm, Brian J. Cardiff [EMAIL PROTECTED] wrote: Is there a way to specify an AttributeFilter for attributes within a certain namespace? I try some alternatives but it seems that is not implemented. For example: span x:foo=barLorem/span I would need that something like $('[x:foo]') find the span element. Thanks. Brian J. Cardiff bcardiff(?)gmail.com .
[jQuery] Re: Attribute selector with namespace
http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_that_has_weird_characters_in_its_ID.3F On Nov 7, 2:06 pm, Brian J. Cardiff [EMAIL PROTECTED] wrote: Is there a way to specify an AttributeFilter for attributes within a certain namespace? I try some alternatives but it seems that is not implemented. For example: span x:foo=barLorem/span I would need that something like $('[x:foo]') find the span element. Thanks. Brian J. Cardiff bcardiff(?)gmail.com .
[jQuery] Re: Attribute selector with namespace
thanks but that it isn't working in this scenario for: span x:foo=barLorem/span the expression: $('span').filter(function(){return $(this).attr(x:foo);}) returns the span element but neither: $('[x:foo]') no: $('[x\\:foo]') find it any clue? Brian J. Cardiff bcardiff(?)gmail.com . On Fri, Nov 7, 2008 at 6:11 PM, MorningZ [EMAIL PROTECTED] wrote: http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_that_has_weird_characters_in_its_ID.3F On Nov 7, 2:06 pm, Brian J. Cardiff [EMAIL PROTECTED] wrote: Is there a way to specify an AttributeFilter for attributes within a certain namespace? I try some alternatives but it seems that is not implemented. For example: span x:foo=barLorem/span I would need that something like $('[x:foo]') find the span element. Thanks. Brian J. Cardiff bcardiff(?)gmail.com .
[jQuery] Re: Attribute selector with namespace
Hmmm.. interesting the second one there didn't work... Well, I tried (and even just worked up a little page trying some other things) good luck getting it rollin' On Nov 7, 5:48 pm, Brian J. Cardiff [EMAIL PROTECTED] wrote: thanks but that it isn't working in this scenario for: span x:foo=barLorem/span the expression: $('span').filter(function(){return $(this).attr(x:foo);}) returns the span element but neither: $('[x:foo]') no: $('[x\\:foo]') find it any clue? Brian J. Cardiff bcardiff(?)gmail.com . On Fri, Nov 7, 2008 at 6:11 PM, MorningZ [EMAIL PROTECTED] wrote: http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_... On Nov 7, 2:06 pm, Brian J. Cardiff [EMAIL PROTECTED] wrote: Is there a way to specify an AttributeFilter for attributes within a certain namespace? I try some alternatives but it seems that is not implemented. For example: span x:foo=barLorem/span I would need that something like $('[x:foo]') find the span element. Thanks. Brian J. Cardiff bcardiff(?)gmail.com .
[jQuery] Re: Attribute selector with namespace
I also took a stab at this and...had no luck. If it wasn't obvious, I think jQuery is getting tripped up on the : because of :'s association with filters. Not sure if there'll be an easy workaround. Max On Nov 7, 3:21 pm, MorningZ [EMAIL PROTECTED] wrote: Hmmm.. interesting the second one there didn't work... Well, I tried (and even just worked up a little page trying some other things) good luck getting it rollin' On Nov 7, 5:48 pm, Brian J. Cardiff [EMAIL PROTECTED] wrote: thanks but that it isn't working in this scenario for: span x:foo=barLorem/span the expression: $('span').filter(function(){return $(this).attr(x:foo);}) returns the span element but neither: $('[x:foo]') no: $('[x\\:foo]') find it any clue? Brian J. Cardiff bcardiff(?)gmail.com . On Fri, Nov 7, 2008 at 6:11 PM, MorningZ [EMAIL PROTECTED] wrote: http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_... On Nov 7, 2:06 pm, Brian J. Cardiff [EMAIL PROTECTED] wrote: Is there a way to specify an AttributeFilter for attributes within a certain namespace? I try some alternatives but it seems that is not implemented. For example: span x:foo=barLorem/span I would need that something like $('[x:foo]') find the span element. Thanks. Brian J. Cardiff bcardiff(?)gmail.com .
[jQuery] Re: Attribute Selector
You have some oddly mismatched quotes, but otherwise, yes, that works. Here's a test done in firebug on jquery.com: $('[EMAIL PROTECTED]:][href*=book]').each(function() { console.log(this.href );}); http://www.packtpub.com/jQuery/book/mid/1004077zztq0 http://www.packtpub.com/jQuery/book/mid/1004077zztq0 Hope it helps. --Erik On 2/25/08, Smith, Allex [EMAIL PROTECTED] wrote: Correct me if I am wrong... This selector should: [EMAIL PROTECTED] [EMAIL PROTECTED]:[EMAIL PROTECTED] somedomain.com] only select links that start with mailto:; and contain somedomain.com Correct? Allex
[jQuery] Re: Attribute selector (^=) problem with multiple values
Appears fixed as of 1.1.3 On Jan 10, 2:54 pm, truent [EMAIL PROTECTED] wrote: Im seeing this too. This Works. $(document).ready( function() { $(input).each( function(i){ alert('hi'); } ); This does not: $(document).ready( function() { $(input[id]).each( function(i){ alert('hi'); } ); php webpage snippit fieldset class= collapsiblelegendCategories/legenddiv class=form-item label for=edit-taxonomy-8Aid Year: span class=form-required title=This field is required.*/span/label select name=taxonomy[8][] multiple=multiple class=form-select required id=edit-taxonomy-8 size=4option value=23 selected=selected2006-07/optionoption value=202007-08/ optionoption value=212008-09/optionoption value=222009-10/ option/select div class=descriptionSelect one or more aid years (hold down [Ctrl] to select more than one year)./div /div div class=form-item label for=edit-taxonomy-5Product: /label select name=taxonomy[5] class=form-select id=edit-taxonomy-5option value=0lt;nonegt;/optionoption value=25Batch Program/optionoption value=24Desktop Application/optionoption value=26Electronic Data Interchange/optionoption value=13PeopleSoft/optionoption value=15-Modules/ optionoption value=16-Reports/optionoption value=14Web Applications/option/select /div div class=form-item label for=edit-taxonomy-9Eqiupment Request: /label select name=taxonomy[9] class=form-select id=edit-taxonomy-9option value=0lt;nonegt;/optionoption value=32Laptop/ optionoption value=34Projector/optionoption value=33Videoconference Setup/option/select /div /fieldset Im trying to grab those taxonomy selects... On Dec 20 2007, 2:22 am, Nicolas Le Thierry d'Ennequin [EMAIL PROTECTED] wrote: Hi jQuery group, The simple piece of code below is designed to highlight table cells whose class name is that of the currently hovered one (to visually group them). In my example the class name itself is film + id (film1, film2, etc) so I use the [attribute^=value] selector. OK to that point, but if the class attribute happens to have whitespace-separated extra content for css purposes (eg class=film1 small ), the selector doesn't capture the element. More generally it seems to dodge any attribute value ending with a white-space + another char. Any idea why? code $(document).ready(function() { $([class^='film']).bind(mouseover,function() { $ (.+this.attributes['class'].value).css({cursor:pointer,background- color:#FFCC99}); }); $([class^='film']).bind(mouseout,function() { $ (.+this.attributes['class'].value).css({cursor:pointer,background- color:transparent}); }); /code Thanks.
[jQuery] Re: Attribute selector (^=) problem with multiple values
Im seeing this too. This Works. $(document).ready( function() { $(input).each( function(i){ alert('hi'); } ); This does not: $(document).ready( function() { $(input[id]).each( function(i){ alert('hi'); } ); php webpage snippit fieldset class= collapsiblelegendCategories/legenddiv class=form-item label for=edit-taxonomy-8Aid Year: span class=form-required title=This field is required.*/span/label select name=taxonomy[8][] multiple=multiple class=form-select required id=edit-taxonomy-8 size=4option value=23 selected=selected2006-07/optionoption value=202007-08/ optionoption value=212008-09/optionoption value=222009-10/ option/select div class=descriptionSelect one or more aid years (hold down [Ctrl] to select more than one year)./div /div div class=form-item label for=edit-taxonomy-5Product: /label select name=taxonomy[5] class=form-select id=edit-taxonomy-5 option value=0lt;nonegt;/optionoption value=25Batch Program/optionoption value=24Desktop Application/optionoption value=26Electronic Data Interchange/optionoption value=13PeopleSoft/optionoption value=15-Modules/ optionoption value=16-Reports/optionoption value=14Web Applications/option/select /div div class=form-item label for=edit-taxonomy-9Eqiupment Request: /label select name=taxonomy[9] class=form-select id=edit-taxonomy-9 option value=0lt;nonegt;/optionoption value=32Laptop/ optionoption value=34Projector/optionoption value=33Videoconference Setup/option/select /div /fieldset Im trying to grab those taxonomy selects... On Dec 20 2007, 2:22 am, Nicolas Le Thierry d'Ennequin [EMAIL PROTECTED] wrote: Hi jQuery group, The simple piece of code below is designed to highlight table cells whose class name is that of the currently hovered one (to visually group them). In my example the class name itself is film + id (film1, film2, etc) so I use the [attribute^=value] selector. OK to that point, but if the class attribute happens to have whitespace-separated extra content for css purposes (eg class=film1 small ), the selector doesn't capture the element. More generally it seems to dodge any attribute value ending with a white-space + another char. Any idea why? code $(document).ready(function() { $([class^='film']).bind(mouseover,function() { $ (.+this.attributes['class'].value).css({cursor:pointer,background- color:#FFCC99}); }); $([class^='film']).bind(mouseout,function() { $ (.+this.attributes['class'].value).css({cursor:pointer,background- color:transparent}); }); /code Thanks.
[jQuery] Re: Attribute Selector Docs Error?
I have been following the docs and using a very recent version of jQuery. The docs don't mention the @ thing at all and I was wondering why my selector didn't work... Well obviously I'll upgrade and leave out the @ but it would have been handy to learn this just by reading the docs... The docs are correct as of jQuery version 1.2. Previous versions use @. Actually, you can get by using @ even in 1.2, but it's deprecated.
[jQuery] Re: Attribute Selector Docs Error?
Hi Chris, The docs are correct as of jQuery version 1.2. Previous versions use @. Actually, you can get by using @ even in 1.2, but it's deprecated. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 10, 2007, at 1:44 PM, Chris Scott wrote: In the attribute selector docs (http://docs.jquery.com/Selectors) it looks like all the selectors are missing an @ before the attribute. e.g. [attribute^=value] should be [EMAIL PROTECTED] At least this is what I found to work after beating my head against a selector for about 20 minutes. :-) Just want to confirm this correct before I go editing the doc pages for these. Thanks. -- Chris Scott Adaptive Hosting Solutions, Inc. | Blogzerk - blog hosting http://www.adaptivehostingsolutions.com/ | http://www.blogzerk.com/
[jQuery] Re: Attribute Selector Docs Error?
Karl Swedberg wrote: Hi Chris, The docs are correct as of jQuery version 1.2. Previous versions use @. Actually, you can get by using @ even in 1.2, but it's deprecated. Ever have one of those times when you *swore* you checked the version and *swore* you double-checked your code? This was one of those. In one of my tests which was on 1.2.1, it wasn't working before but is now as you've noted. Thanks for clearing this up for me. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 10, 2007, at 1:44 PM, Chris Scott wrote: In the attribute selector docs (http://docs.jquery.com/Selectors) it looks like all the selectors are missing an @ before the attribute. e.g. [attribute^=value] should be [EMAIL PROTECTED] At least this is what I found to work after beating my head against a selector for about 20 minutes. :-) Just want to confirm this correct before I go editing the doc pages for these. Thanks. -- Chris Scott Adaptive Hosting Solutions, Inc. | Blogzerk - blog hosting http://www.adaptivehostingsolutions.com/ | http://www.blogzerk.com/ -- Chris Scott Adaptive Hosting Solutions, Inc. | Blogzerk - blog hosting http://www.adaptivehostingsolutions.com/ | http://www.blogzerk.com/
[jQuery] Re: Attribute Selector Docs Error?
On Oct 10, 2007, at 2:54 PM, Chris Scott wrote: Karl Swedberg wrote: Hi Chris, The docs are correct as of jQuery version 1.2. Previous versions use @. Actually, you can get by using @ even in 1.2, but it's deprecated. Ever have one of those times when you *swore* you checked the version and *swore* you double-checked your code? This was one of those. In one of my tests which was on 1.2.1, it wasn't working before but is now as you've noted. Thanks for clearing this up for me. Heh. That kind of thing happens to me all the time. Glad things are working as expected now. :-) --Karl