Re: [jQuery] how to find an item when you only know part of the class name

2007-03-03 Thread John Resig
I'm not sure what the issue is that you're referring to, I just ran
the test and it seems to work as you would expect it to: Clicking the
link strikes out the line:
http://john.jquery.com/ticket/td-attr/

Isn't there another aspect at play here?

My first recommendation would be to change:
 var parentDiv = $(this).parents([EMAIL PROTECTED]);

to:
 var parentDiv = $(this).parents(div:first);

And see if that helps anything - you may be, simply, selecting too
many parent elements.

--John

On 3/2/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:



   ---Original Message---
   From: Jake McGraw [EMAIL PROTECTED]
   Subject: Re: [jQuery] how to find an item when you only know part of the 
  class name
   Sent: Mar 02 '07 23:19
 
   Not sure if the source is like this too, but you haven't closed this
   element (insert a /a):
 
   a href='#' class=toggleStrikeRemove/a /td
 
   Maybe, that'll help?
 
   - jake
 
 
   On 3/2/07,  [LINK: MAILTO:[EMAIL PROTECTED]
   [EMAIL PROTECTED] [LINK: mailto:[EMAIL PROTECTED]
   [EMAIL PROTECTED] wrote:
 
 
 ---Original Message---
 From: Jake McGraw [LINK: mailto:[EMAIL PROTECTED]
   [EMAIL PROTECTED]
 Subject: Re: [jQuery] how to find an item when you only know part of
   the class name
 Sent: Mar 02 '07 22:46
   
 You can reference any attribute using the following notation:
   
 [EMAIL PROTECTED] Starts with
 [EMAIL PROTECTED] Ends with
 [EMAIL PROTECTED] equals
 [EMAIL PROTECTED] contains
   
 So for your problem...
   
 $([EMAIL PROTECTED])
   
 Hope this helps,
   
 - jake
   
   
 On 3/2/07, [LINK: MAILTO: [LINK: mailto:[EMAIL PROTECTED]
   [EMAIL PROTECTED]
 [LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
   [LINK: mailto:[LINK: mailto:[EMAIL PROTECTED]
   [EMAIL PROTECTED]
 [LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
   wrote: Hi,
   
 I have a DIV whose ID I know.  Within that DIV is a table with a table
 cell which either has a class beginning with the word title and
   followed
 by an integer.  I would like to reference the text within that table
   cell.
 What is the easiest way to get a reference to this cell?
   
 Thanks, - Dave
   
 ___
 jQuery mailing list
 [LINK: mailto:[LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
   [LINK: mailto:[EMAIL PROTECTED]  discuss@jquery.com
 [LINK: [LINK: http://jquery.com/discuss/] http://jquery.com/discuss/]
   [LINK: http://jquery.com/discuss/] http://jquery.com/discuss/
 
   I appreciate your reply.  I'm still not finding the element, and I
   wanted to ask what I was doing wrong.  The JS is
 
   $(document).ready(
   function () {
   $('a.toggleStrike').click( function() {
   var parentDiv =
   $(this).parents([EMAIL PROTECTED]);
   alert(parentDiv[0].id);
   var tdElt =
   parentDiv.find([EMAIL PROTECTED]);
   alert(tdElt[0].id);
   var textDecor =
   tdElt.css('text-decoration');
   var newDecor = textDecor == line-through
 none : line-through;
   tdElt.css('text-decoration',
   newDecor);
   });
   }
   )
 
   and a sample HTML div would be
 
   div id=toc25 class=tocItem15-2
   style=display:block; margin-left:30px
   div style=display:blocktable
   tr
   td/td
   td
   style=text-decoration:none class=title3Lesson 1 Core Ancient
   Americans/td
   tda class=readMore
   href='#'Read/a/td
 
   tda href='#'
   class=toggleStrikeRemove/td
   /tr
   /table/div
   /div
 
   The first alert displays the correct value, but the second alert displays
   a blank box and subsequently everything in the highest level table gets a
   strike through it when I just want this one cell.
 
   Thanks, - Dave
 
   ___
   jQuery mailing list
   [LINK: mailto:[EMAIL PROTECTED] discuss@jquery.com
   [LINK: http://jquery.com/discuss/] http://jquery.com/discuss/


 That was indeed a problem.  Sadly, even after I remedied that, I still get 
 the same result -- the second alert shows a blank value and the entire table 
 gets a line through it.

  - Dave

 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] how to find an item when you only know part of the class name

2007-03-02 Thread Jake McGraw

You can reference any attribute using the following notation:

[EMAIL PROTECTED] Starts with
[EMAIL PROTECTED] Ends with
[EMAIL PROTECTED] equals
[EMAIL PROTECTED] contains

So for your problem...

$([EMAIL PROTECTED])

Hope this helps,

- jake

On 3/2/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


Hi,

I have a DIV whose ID I know.  Within that DIV is a table with a table
cell which either has a class beginning with the word title and followed
by an integer.  I would like to reference the text within that table
cell.  What is the easiest way to get a reference to this cell?

Thanks, - Dave

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] how to find an item when you only know part of the class name

2007-03-02 Thread dalvarado



  ---Original Message---
  From: Jake McGraw [EMAIL PROTECTED]
  Subject: Re: [jQuery] how to find an item when you only know part of the 
 class name
  Sent: Mar 02 '07 22:46
  
  You can reference any attribute using the following notation:
  
  [EMAIL PROTECTED] Starts with
  [EMAIL PROTECTED] Ends with
  [EMAIL PROTECTED] equals
  [EMAIL PROTECTED] contains
  
  So for your problem...
  
  $([EMAIL PROTECTED])
  
  Hope this helps,
  
  - jake
  
  
  On 3/2/07, [LINK: MAILTO:[EMAIL PROTECTED]
  [EMAIL PROTECTED]  [LINK: mailto:[EMAIL PROTECTED]
  [EMAIL PROTECTED] wrote: Hi,
  
  I have a DIV whose ID I know.  Within that DIV is a table with a table
  cell which either has a class beginning with the word title and followed
  by an integer.  I would like to reference the text within that table cell.
  What is the easiest way to get a reference to this cell?
  
  Thanks, - Dave
  
  ___
  jQuery mailing list
  [LINK: mailto:[EMAIL PROTECTED] discuss@jquery.com
  [LINK: http://jquery.com/discuss/] http://jquery.com/discuss/

I appreciate your reply.  I'm still not finding the element, and I wanted to 
ask what I was doing wrong.  The JS is

$(document).ready(
function () {
$('a.toggleStrike').click( function() {
var parentDiv = $(this).parents([EMAIL 
PROTECTED]);
alert(parentDiv[0].id);
var tdElt = parentDiv.find([EMAIL PROTECTED]);
alert(tdElt[0].id);
var textDecor = tdElt.css('text-decoration');
var newDecor = textDecor == line-through ? 
none : line-through;
tdElt.css('text-decoration', newDecor);
});
}
)

and a sample HTML div would be

div id=toc25 class=tocItem15-2 
style=display:block; margin-left:30px
div style=display:blocktable
tr
td/td
td 
style=text-decoration:none class=title3Lesson 1 Core Ancient Americans/td
tda class=readMore 
href='#'Read/a/td

tda href='#' 
class=toggleStrikeRemove/td
/tr
/table/div
/div

The first alert displays the correct value, but the second alert displays a 
blank box and subsequently everything in the highest level table gets a strike 
through it when I just want this one cell.

Thanks, - Dave

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] how to find an item when you only know part of the class name

2007-03-02 Thread dalvarado



  ---Original Message---
  From: Jake McGraw [EMAIL PROTECTED]
  Subject: Re: [jQuery] how to find an item when you only know part of the 
 class name
  Sent: Mar 02 '07 23:19
  
  Not sure if the source is like this too, but you haven't closed this
  element (insert a /a):
  
  a href='#' class=toggleStrikeRemove/a /td
  
  Maybe, that'll help?
  
  - jake
  
  
  On 3/2/07,  [LINK: MAILTO:[EMAIL PROTECTED]
  [EMAIL PROTECTED] [LINK: mailto:[EMAIL PROTECTED]
  [EMAIL PROTECTED] wrote:
  
  
---Original Message---
From: Jake McGraw [LINK: mailto:[EMAIL PROTECTED]
  [EMAIL PROTECTED]
Subject: Re: [jQuery] how to find an item when you only know part of
  the class name
Sent: Mar 02 '07 22:46
  
You can reference any attribute using the following notation:
  
[EMAIL PROTECTED] Starts with
[EMAIL PROTECTED] Ends with
[EMAIL PROTECTED] equals
[EMAIL PROTECTED] contains
  
So for your problem...
  
$([EMAIL PROTECTED])
  
Hope this helps,
  
- jake
  
  
On 3/2/07, [LINK: MAILTO: [LINK: mailto:[EMAIL PROTECTED]
  [EMAIL PROTECTED]
[LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
  [LINK: mailto:[LINK: mailto:[EMAIL PROTECTED]
  [EMAIL PROTECTED]
[LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
  wrote: Hi,
  
I have a DIV whose ID I know.  Within that DIV is a table with a table
cell which either has a class beginning with the word title and
  followed
by an integer.  I would like to reference the text within that table
  cell.
What is the easiest way to get a reference to this cell?
  
Thanks, - Dave
  
___
jQuery mailing list
[LINK: mailto:[LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
  [LINK: mailto:[EMAIL PROTECTED]  discuss@jquery.com
[LINK: [LINK: http://jquery.com/discuss/] http://jquery.com/discuss/]
  [LINK: http://jquery.com/discuss/] http://jquery.com/discuss/
  
  I appreciate your reply.  I'm still not finding the element, and I
  wanted to ask what I was doing wrong.  The JS is
  
  $(document).ready(
  function () {
  $('a.toggleStrike').click( function() {
  var parentDiv =
  $(this).parents([EMAIL PROTECTED]);
  alert(parentDiv[0].id);
  var tdElt =
  parentDiv.find([EMAIL PROTECTED]);
  alert(tdElt[0].id);
  var textDecor =
  tdElt.css('text-decoration');
  var newDecor = textDecor == line-through
none : line-through;
  tdElt.css('text-decoration',
  newDecor);
  });
  }
  )
  
  and a sample HTML div would be
  
  div id=toc25 class=tocItem15-2
  style=display:block; margin-left:30px
  div style=display:blocktable
  tr
  td/td
  td
  style=text-decoration:none class=title3Lesson 1 Core Ancient
  Americans/td
  tda class=readMore
  href='#'Read/a/td
  
  tda href='#'
  class=toggleStrikeRemove/td
  /tr
  /table/div
  /div
  
  The first alert displays the correct value, but the second alert displays
  a blank box and subsequently everything in the highest level table gets a
  strike through it when I just want this one cell.
  
  Thanks, - Dave
  
  ___
  jQuery mailing list
  [LINK: mailto:[EMAIL PROTECTED] discuss@jquery.com
  [LINK: http://jquery.com/discuss/] http://jquery.com/discuss/


That was indeed a problem.  Sadly, even after I remedied that, I still get the 
same result -- the second alert shows a blank value and the entire table gets a 
line through it.

 - Dave

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] how to find an item when you only know part of the class name

2007-03-02 Thread Jake McGraw

Not sure if the source is like this too, but you haven't closed this element
(insert a /a):

a href='#' class=toggleStrikeRemove/a/td

Maybe, that'll help?

- jake

On 3/2/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:





  ---Original Message---
  From: Jake McGraw [EMAIL PROTECTED]
  Subject: Re: [jQuery] how to find an item when you only know part of
the class name
  Sent: Mar 02 '07 22:46

  You can reference any attribute using the following notation:

  [EMAIL PROTECTED] Starts with
  [EMAIL PROTECTED] Ends with
  [EMAIL PROTECTED] equals
  [EMAIL PROTECTED] contains

  So for your problem...

  $([EMAIL PROTECTED])

  Hope this helps,

  - jake


  On 3/2/07, [LINK: MAILTO:[EMAIL PROTECTED]
  [EMAIL PROTECTED]  [LINK: mailto:[EMAIL PROTECTED]
]
  [EMAIL PROTECTED] wrote: Hi,

  I have a DIV whose ID I know.  Within that DIV is a table with a table
  cell which either has a class beginning with the word title and
followed
  by an integer.  I would like to reference the text within that table
cell.
  What is the easiest way to get a reference to this cell?

  Thanks, - Dave

  ___
  jQuery mailing list
  [LINK: mailto:[EMAIL PROTECTED] discuss@jquery.com
  [LINK: http://jquery.com/discuss/] http://jquery.com/discuss/

I appreciate your reply.  I'm still not finding the element, and I wanted
to ask what I was doing wrong.  The JS is

$(document).ready(
function () {
$('a.toggleStrike').click( function() {
var parentDiv =
$(this).parents([EMAIL PROTECTED]);
alert(parentDiv[0].id);
var tdElt = parentDiv.find
([EMAIL PROTECTED]);
alert(tdElt[0].id);
var textDecor = tdElt.css
('text-decoration');
var newDecor = textDecor == line-through
? none : line-through;
tdElt.css('text-decoration', newDecor);
});
}
)

and a sample HTML div would be

div id=toc25 class=tocItem15-2
style=display:block; margin-left:30px
div style=display:blocktable
tr
td/td
td
style=text-decoration:none class=title3Lesson 1 Core Ancient
Americans/td
tda class=readMore
href='#'Read/a/td

tda href='#'
class=toggleStrikeRemove/td
/tr
/table/div
/div

The first alert displays the correct value, but the second alert displays
a blank box and subsequently everything in the highest level table gets a
strike through it when I just want this one cell.

Thanks, - Dave

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/