[jQuery] Re: Anchor Child Not Responding to Hover

2010-01-02 Thread Steven
I solved it by hiding the span with hide() rather than CSS. Although I'd like to know why straight CSS breaks this while adding display:none; via JavaScript works fine.

[jQuery] Re: Anchor Child Not Responding to Hover

2010-01-02 Thread Šime Vidas
You mean this? http://vidasp.net/jquery-example5.html

[jQuery] Re: li:nth-child(10) toggle

2009-06-20 Thread bombaru
Works like a champ! Thank you again (mkmanning and karl) for all of your help. On Jun 19, 9:16 pm, bombaru bomb...@gmail.com wrote: Thanks mkmanning!!!  I'll give this a try tomorrow and let you know. Looking at it though... I'm pretty confident it will do the trick. It's amazing how much

[jQuery] Re: li:nth-child(10) toggle

2009-06-20 Thread bombaru
One question with this approach... how would I implement this only on groups that contain more than 10 LI's? Right now it's getting added to every LI group. Groups with less than 10 LI's are also getting the more link appended but there is obviously nothing to toggle. Thanks again. This

[jQuery] Re: li:nth-child(10) toggle

2009-06-20 Thread bombaru
You are a rock star! I can't thank you enough. On Jun 20, 1:55 pm, mkmanning michaell...@gmail.com wrote: A minor refactor then: $('.main ul').each(function(){ var $this = $(this), lis = $this.find('li:gt(9)').hide();         if(lis.length0){        

[jQuery] Re: li:nth-child(10) toggle

2009-06-20 Thread mkmanning
A minor refactor then: $('.main ul').each(function(){ var $this = $(this), lis = $this.find('li:gt(9)').hide(); if(lis.length0){ $this.append($('li').text('More').click(function(){ lis.toggle(); $(this).text($(this).text() === 'More' ?

[jQuery] Re: li:nth-child(10) toggle

2009-06-19 Thread Karl Swedberg
I'd probably use .slice(). Something like this should work: $(document).ready(function() { var $list = $('.main ul'), $items = $list.find('li'), $moreLink = $('a href=#more/a'); if ($items.length 10) { $moreItems = $('ul/ul').append($items.slice(10)).hide();

[jQuery] Re: li:nth-child(10) toggle

2009-06-19 Thread bombaru
Thanks Karl... I'm not familiar with slice() but will definitely read up on it. The problem I'm having with this approach is that every LI after the 10th one is being hidden. Here's an example of what the HTML looks like without any JS applied to it: ul id=narrow-search li class=main

[jQuery] Re: li:nth-child(10) toggle

2009-06-19 Thread mkmanning
Try this: $('.main ul').each(function(){ var $this = $(this), lis = $this.append($('li').text('More').click (function(){ lis.toggle(); $(this).text($(this).text() === 'More' ? 'Less' : 'More'); })).find('li:gt(9):not(:last)').hide(); }); Since you

[jQuery] Re: li:nth-child(10) toggle

2009-06-19 Thread mkmanning
And you can shorten it slightly: $('.main ul').each(function(){ var lis = $(this).append($('li').text('More').click(function(){ lis.toggle(); $(this).text($(this).text() === 'More' ? 'Less' : 'More'); })).find('li:gt(9):not(:last)').hide(); }); I

[jQuery] Re: li:nth-child(10) toggle

2009-06-19 Thread Karl Swedberg
Ah, I see. Helps to be able to see the HTML. Let us know if mkmanning's approach doesn't do the trick. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jun 19, 2009, at 5:56 PM, bombaru wrote: Thanks Karl... I'm not familiar with slice() but will

[jQuery] Re: li:nth-child(10) toggle

2009-06-19 Thread bombaru
Thanks mkmanning!!! I'll give this a try tomorrow and let you know. Looking at it though... I'm pretty confident it will do the trick. It's amazing how much more efficiently the original chunk of code can be written and it still makes perfect sense (actually it's clearer). On Jun 19, 7:36 pm,

[jQuery] Re: first child

2009-04-09 Thread bart
Thank you all very much for replying. Mauricio's code worked for me :) var el = $('#continer *:first').is('h2'); alert(el); // returns true if first child is H2, false otherwise Again, thanks! :) On Apr 7, 10:04 pm, Eric Garside gars...@gmail.com wrote: I think I understand what you want. Try

[jQuery] Re: first child

2009-04-07 Thread Chuck Harmston
This will return the tag name of a container's first child: $('#container *')[0].tagName; Hope it's useful! Chuck Harmston http://chuckharmston.com On Tue, Apr 7, 2009 at 11:37 AM, bart b...@ivwd.nl wrote: Hello all, Let's say I'd have a div#content and I'd like to figure out what the

[jQuery] Re: first child

2009-04-07 Thread Mauricio (Maujor) Samy Silva
var $el = xx.is('h2'); //if it indeed matches a h2, returns true? var el = $('#continer *:first').is('h2'); alert(el); // returns true if first child is H2, false otherwise. Maurício

[jQuery] Re: first child

2009-04-07 Thread Eric Garside
I think I understand what you want. Try this: $('#content :first-child')[0].tagName.toLowerCase(); // Will return a if it's an anchor, div for a div, img for an image tag, etc. On Apr 7, 12:37 pm, Mauricio \(Maujor\) Samy Silva css.mau...@gmail.com wrote: var $el = xx.is('h2'); //if it

[jQuery] Re: tbody:first-child thead

2009-02-25 Thread David Muir
It's because tbody:first-child is already selecting the tr, so you're effectively doing: tbody tr tr (where the first tr is the first child of tbody) Cheers, David Alex Wibowo wrote: Hi all, I have a code that counts the number of rows in a table... the table looks like: table

[jQuery] Re: tbody:first-child thead

2009-02-25 Thread Alex Wibowo
how does that explain the behaviour when there's thead then?? On Wed, Feb 25, 2009 at 7:47 PM, David Muir davidkm...@gmail.com wrote: It's because tbody:first-child is already selecting the tr, so you're effectively doing: tbody tr tr (where the first tr is the first child of tbody)

[jQuery] Re: tbody:first-child thead

2009-02-25 Thread Alex Wibowo
sorry i should say how does that explain the behaviour when there's no thead (because it works when thead doesnt exist) On Wed, Feb 25, 2009 at 8:06 PM, Alex Wibowo alexwib...@gmail.com wrote: how does that explain the behaviour when there's thead then?? On Wed, Feb 25, 2009 at 7:47

[jQuery] Re: tbody:first-child thead

2009-02-25 Thread Karl Rudd
tbody:first-child doesn't select the first child of the tbody it says select the tbody that is the 'first-child' of it's parent. So what you are actually wanting to say is: $(#myTable tbody tr:first-child) Which is select the tr that is the first child of tbody

[jQuery] Re: tbody:first-child thead

2009-02-25 Thread David Muir
Oops. Got tripped up by this last week too... David Karl Rudd wrote: tbody:first-child doesn't select the first child of the tbody it says select the tbody that is the 'first-child' of it's parent. So what you are actually wanting to say is: $(#myTable tbody tr:first-child) Which is select

[jQuery] Re: tbody:first-child thead

2009-02-25 Thread Alex Wibowo
Hi Karl.. thanks for the reply... what i actually wanted is to select the first tbody thats why i specified tbody:first-child there since a table can have multiple tbody... i want to select the first tbody. What I didnt understand is about the thead.. the following works

[jQuery] Re: tbody:first-child thead

2009-02-25 Thread David Muir
Because tbody is no longer the first child. What you want is tbody:first which will grab the first tbody. David Alex Wibowo wrote: Hi Karl.. thanks for the reply... what i actually wanted is to select the first tbody thats why i specified tbody:first-child there since a table

[jQuery] Re: tbody:first-child thead

2009-02-25 Thread Mauricio (Maujor) Samy Silva
Assunto: [jQuery] Re: tbody:first-child thead Hi Karl.. thanks for the reply... what i actually wanted is to select the first tbody thats why i specified tbody:first-child there since a table can have multiple tbody... i want to select the first tbody. What I didnt

[jQuery] Re: tbody:first-child thead

2009-02-25 Thread Mauricio (Maujor) Samy Silva
: [jQuery] Re: tbody:first-child thead Hi Alex, 1-) Doesn't work because * E F:first-child * pseudo-class selector matches the F element that is the first child of the E element ONLY if there isn't another element BEFORE the E element within the parent E. See specs at: http://www.w3.org/TR

[jQuery] Re: tbody:first-child thead

2009-02-25 Thread Alex Wibowo
... instead of: ...BEFORE the E element... -Mensagem Original- *De:* Mauricio (Maujor) Samy Silva css.mau...@gmail.com *Para:* jquery-en@googlegroups.com *Enviada em:* quarta-feira, 25 de fevereiro de 2009 09:24 *Assunto:* Re: [jQuery] Re: tbody:first-child thead Hi Alex, 1-) Doesn't

[jQuery] Re: tbody:first-child thead

2009-02-25 Thread Mauricio (Maujor) Samy Silva
@googlegroups.com Enviada em: quarta-feira, 25 de fevereiro de 2009 09:43 Assunto: [jQuery] Re: tbody:first-child thead ahhh ok ... now i get it. sorry for wasting your time, guys... i thought its E F:first-child reads the first child of E of type F... i didn't know that it has

[jQuery] Re: tbody:first-child thead

2009-02-25 Thread ricardobeat
Tables have native properties which are much faster to access: $('#myTable')[0].rows.length //number of rows $('#myTable')[0].tBodies[0].rows.length //number of rows in the first tbody cheers, - ricardo On Feb 25, 5:25 am, Alex Wibowo alexwib...@gmail.com wrote: Hi all, I have a code that

[jQuery] Re: tbody:first-child thead

2009-02-25 Thread Alex Wibowo
Hi Ricardo Thats great... thx a lot! On Thu, Feb 26, 2009 at 5:06 AM, ricardobeat ricardob...@gmail.com wrote: Tables have native properties which are much faster to access: $('#myTable')[0].rows.length //number of rows $('#myTable')[0].tBodies[0].rows.length //number of rows in the first

[jQuery] Re: Toggle child elements

2009-01-26 Thread Wacko Jacko
Ok, thank. I understand this. What I am asking however is how I can accomplish what I am after? Any ideas? I would like for this div and the list inside of it to slide down / tween down into position together. On Jan 23, 9:52 am, donb falconwatc...@comcast.net wrote: The example doesn't

[jQuery] Re: Toggle child elements

2009-01-22 Thread Wacko Jacko
Anyone? Am a barking up the wrong tree? On Jan 12, 10:48 am, Wacko Jacko jackson.be...@gmail.com wrote: Hi donb, It sounds like you know much more than I do. I am still quite new to jQuery. Can you point me in the right direction to have these elements slide in (down)? Thanks in advance

[jQuery] Re: Toggle child elements

2009-01-22 Thread donb
The example doesn't 'slide' it has a fixed top position. The height of the container increases from zero to some value, gradually revealing the contents - much as if you are opening a sliding door. On Jan 22, 6:05 pm, Wacko Jacko jackson.be...@gmail.com wrote: Anyone? Am a barking up the wrong

[jQuery] Re: Toggle child elements

2009-01-11 Thread Wacko Jacko
Hi donb, It sounds like you know much more than I do. I am still quite new to jQuery. Can you point me in the right direction to have these elements slide in (down)? Thanks in advance for your help. Jackson On Jan 8, 2:01 pm, donb falconwatc...@comcast.net wrote: Ddoesn't the animation

[jQuery] Re: Toggle child elements

2009-01-07 Thread donb
Ddoesn't the animation actually consist of an expanding div - meaning, the contents (and the outermost div) are fixed in position? Nothing is actually 'sliding down' On Jan 7, 8:58 pm, Wacko Jacko jackson.be...@gmail.com wrote: Hi All, Quite new to jQuery so would very much appreciate your

[jQuery] Re: add child to ul very simple question!

2008-11-07 Thread Rik Lomas
You can do: $('#test').after('liHello/li'); or: $('#test').parent().append('liHello/li'); Rik 2008/11/7 jfk [EMAIL PROTECTED]: Ok, this probably just needs someone to slap me towards a tutorial, however I couldn't seem to find one! I'm trying to use jquery to add a child to part of an

[jQuery] Re: accessing child element without unique id

2008-11-05 Thread FrenchiINLA
var $col = $('#row1 td') will give you a collection of all td under row1, then you can filter by first, last, or even use ordianal positon like $col[0] etc. On Nov 5, 11:59 am, Jared_T [EMAIL PROTECTED] wrote: I'm trying to access a td text value, as shown in the javascript below.  The easiet

[jQuery] Re: nth-child(n) not working for me.

2008-09-18 Thread Richard D. Worth
On Wed, Sep 17, 2008 at 11:29 PM, Karl Swedberg [EMAIL PROTECTED]wrote: Hi kcharles, you need to concatenate the variable, n, with the rest of the selector expression. Otherwise, it's treated as the string, n. Try this: $(#filterTable tbody tr td:nth-child( + n + )).each(function(){ Also,

[jQuery] Re: nth-child(n) not working for me - I didn't see my previous post

2008-09-18 Thread kcharles
You rock! That was it. -Kevin

[jQuery] Re: nth-child(n) not working for me.

2008-09-18 Thread Karl Swedberg
Do people really put td elements in a thead? Figured they would just use th. Hadn't considered tfoot though. Good point. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Sep 18, 2008, at 5:44 AM, Richard D. Worth wrote: On Wed, Sep 17, 2008 at 11:29 PM,

[jQuery] Re: nth-child(n) not working for me - I didn't see my previous post

2008-09-17 Thread ricardobeat
You're not really referencing the 'n' variable you just defined, as you're passing a string. var n = 2; $(#filterTable tbody tr td:nth-child(+n+)).each(function(){ On Sep 17, 2:24 pm, kcharles [EMAIL PROTECTED] wrote: I switch between var n = 2; nth-child(n) and nth-child(2) and get

[jQuery] Re: nth-child(n) not working for me.

2008-09-17 Thread Karl Swedberg
Hi kcharles, you need to concatenate the variable, n, with the rest of the selector expression. Otherwise, it's treated as the string, n. Try this: $(#filterTable tbody tr td:nth-child( + n + )).each(function(){ Also, you probably don't need either the tbody or tr part in there since,

[jQuery] Re: nth-child() vs. even/odd

2008-08-24 Thread Karl Swedberg
On Aug 23, 2008, at 11:11 PM, Dave Methvin wrote: In contrast, :nth-child(even) selects the even children of the element(s) in the jQuery object. Just to clarify, :nth-child(even) selects all elements in the jQuery object that are the even children of their parent. For example,

[jQuery] Re: nth-child() vs. even/odd

2008-08-23 Thread Dave Methvin
No, they're definitely not equivalent in the general case. The :even and :odd selectors apply to the even/odd elements in the jQuery object. Depending on what has come earlier in the selector, those elements may not even be related in any way. In contrast, :nth-child(even) selects the even

[jQuery] Re: parent child select

2008-04-28 Thread Karl Swedberg
On Apr 28, 2008, at 11:50 AM, wesbird wrote: Hi, I tried to select all td in the same row from a td, so I tried, $(id).parent( td) it does not work. How I can do it? Hi there, you can do it this way: $(id).parent().children() assume that id is a variable for the beginning td?

[jQuery] Re: jQuery Child Toggle Problems

2008-04-25 Thread shaun haage
i jumped the gun a little, ui.selectable did the trick. Thanks - Original Message From: [EMAIL PROTECTED] [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Friday, April 25, 2008 4:39:34 AM Subject: [jQuery] Re: jQuery Child Toggle Problems Hi, Shaun It's hard

[jQuery] Re: jQuery Child Toggle Problems

2008-04-24 Thread [EMAIL PROTECTED]
Hi, Shaun It's hard to know what you're getting at without an example? The toggle event targets an element, hopefully the one you specified when you called it ;) You can call it by class (thus, a set of elements) and/or by the variety of selector options described in the api docs

[jQuery] Re: first child of type form control

2008-03-31 Thread dug
Thanks Jason :-) How would I handle that if the #elHombre object is inside the form? Cheers, Dug On Mar 27, 12:21 pm, Jason Huck [EMAIL PROTECTED] wrote: Try this: $('#elHombre').next('form').children('input select textarea') [0].focus(); - jason On Mar 27, 6:32 am, DugFalby [EMAIL

[jQuery] Re: first child of type form control

2008-03-31 Thread Richard D. Worth
$('form:has(#elHombre)').children('input, select, textarea')[0].focus(); - Richard On Mon, Mar 31, 2008 at 6:12 AM, dug [EMAIL PROTECTED] wrote: Thanks Jason :-) How would I handle that if the #elHombre object is inside the form? Cheers, Dug On Mar 27, 12:21 pm, Jason Huck [EMAIL

[jQuery] Re: first child of type form control

2008-03-31 Thread Richard D. Worth
On second thought, you'll want to use .find, instead of .children, as the elements could likely be within fieldsets and/or divs: $('form:has(#elHombre)').find('input, select, textarea')[0].focus(); Also, here's another way to get the form from the #elHombre:

[jQuery] Re: first child of type form control

2008-03-27 Thread Jason Huck
Try this: $('#elHombre').next('form').children('input select textarea') [0].focus(); - jason On Mar 27, 6:32 am, Dug Falby [EMAIL PROTECTED] wrote: Hi guys, I've got: $('#elHombre').focus(); Which sets focus to a legend at the top of a form. I'd like to do:

[jQuery] Re: :last-child problem

2008-01-05 Thread Karl Swedberg
Hi Tomek, It works fine for me. How are you testing this? If you have Firefox with Firebug, inspect the last-child element after adding the class. When I did so, I saw this: div class=info green lastbar /div (I had added bar to the HTML for the sake of my test.) --Karl _

[jQuery] Re: Which child am I?

2007-11-27 Thread badtant
Thanks everyone! This is what I ended up using: var index = $(this).parent().children(th).index(this) + 1; /N On Nov 26, 6:58 pm, Glen Lipka [EMAIL PROTECTED] wrote: Getting the row is easier. :) There is a rowIndex attribute.http://commadot.com/jquery/rowindex.php Nuts, I am too late.

[jQuery] Re: Which child am I?

2007-11-26 Thread Glen Lipka
You could dynamically add a psuedo attribute like col with an each function after the page loads. Other than than, I would experiment with colgroup and see if it fires which col you are in. Sorry, no time for a demo. :( Hope this helps a little. Glen On Nov 26, 2007 7:35 AM, badtant [EMAIL

[jQuery] Re: Which child am I?

2007-11-26 Thread Andrea Varnier
On 11/26/07, badtant [EMAIL PROTECTED] wrote: When the user hovers the th-element I have a function. I want that function to return which of the columns that has been hovered. Something like this? td class=col_a onMouseOver=alert(this.className);aaa/td

[jQuery] Re: Which child am I?

2007-11-26 Thread badtant
Adding a psuedo attribute like col with an each function would work. I was hoping there would be some smart jquery-function for this. Keep suggesting =) On Nov 26, 4:46 pm, Glen Lipka [EMAIL PROTECTED] wrote: You could dynamically add a psuedo attribute like col with an each function after the

[jQuery] Re: Which child am I?

2007-11-26 Thread Jonathan Sharp
*Untested* Something similar to: var index = $(this).parent().find(' td').index(this); -js On 11/26/07, badtant [EMAIL PROTECTED] wrote: Adding a psuedo attribute like col with an each function would work. I was hoping there would be some smart jquery-function for this. Keep suggesting

[jQuery] Re: Which child am I?

2007-11-26 Thread Glen Lipka
Getting the row is easier. :) There is a rowIndex attribute. http://commadot.com/jquery/rowindex.php Nuts, I am too late. Question answered. I whipped up a demo anyway. http://commadot.com/jquery/colIndex.php Fun question. Glen On Nov 26, 2007 8:10 AM, jonhobbs [EMAIL PROTECTED] wrote: I

[jQuery] Re: Detect child number of an element?

2007-10-11 Thread Wizzud
var myRows = $('table#id tr').click(function(){ alert('Row #' + myRows.index(this) + ' clicked'); }); (index is 0-based, ie clicking on the 7th row returns 'Row #6 clicked' in the example above.) On Oct 10, 3:28 pm, RichUncleSkeleton [EMAIL PROTECTED] wrote: Is it possible to detect the

[jQuery] Re: Detect child number of an element?

2007-10-10 Thread Dave Methvin
For example, say I have a table with 10 rows. If I click on the 7th row, is it possible to obtain the number 7 simply? The tr element should have both a rowIndex and a sectionRowIndex; I've never used them but they're documented.

[jQuery] Re: Parent Child Selectors + bind

2007-09-26 Thread Remy Sharp
You're binding to 'onfocus' when it should be 'focus': $(#id1 [EMAIL PROTECTED]).bind(focus, foo); On Sep 26, 8:35 am, Anjanesh [EMAIL PROTECTED] wrote: Hi I cant get this seem to work $(#id1 [EMAIL PROTECTED]).bind(onfocus, foo); Is there something wrong with the argument ? Thanks

[jQuery] Re: Parent Child Selectors + bind

2007-09-26 Thread Erik Beeson
Also, your initial selector can be simplified to: $(#id1 :text) --Erik On 9/26/07, Remy Sharp [EMAIL PROTECTED] wrote: You're binding to 'onfocus' when it should be 'focus': $(#id1 [EMAIL PROTECTED]).bind(focus, foo); On Sep 26, 8:35 am, Anjanesh [EMAIL PROTECTED] wrote: Hi I

[jQuery] Re: Parent Child Selectors + bind

2007-09-26 Thread Anjanesh
But doesnt $(#id1 :text) select only the first textbox under #id1 element ? I wanted to bind the focus function to all textboxes under id1. But I found this plugin (http://www.texotela.co.uk/code/jquery/ focusfields/) to do what I wanted to do anyway.

[jQuery] Re: is child of...

2007-04-06 Thread Stefan Petre
Lwis wrote: Hi, short version: how do I find out whether my element is a child of another element? long version: I think I want to loop through all elements and check each of them if it is the element I am searching for or not. I think I want something similar to YUI

[jQuery] Re: is child of...

2007-04-06 Thread Roman Weich
Lwis schrieb: Hi, short version: how do I find out whether my element is a child of another element? long version: I think I want to loop through all elements and check each of them if it is the element I am searching for or not. I think I want something similar to YUI

[jQuery] Re: ***DHSPAM*** [jQuery] Re: is child of...

2007-04-06 Thread Karl Swedberg
On Apr 6, 2007, at 8:53 AM, bmckenzie wrote: $(#someParent).children().index(someElement) != -1 ; Cool, Bruce! you could also come at it from the other direction: if ( $('#someChild').parent('someElement').length ) { //do something }; --Karl _ Karl Swedberg