[jQuery] Re: Using close images

2007-05-30 Thread Karl Swedberg

Hi Jean,

In this situation, .parents() -- with an "s" -- should do the trick.  
You should also put ":first" in there if you have nested divs.


So, try replacing this ...
$(this).parent("div")
with this...
$(this).parents("div:first")


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On May 30, 2007, at 1:59 PM, Jean Nascimento wrote:



I have other question, with this code i´m trying catch the 1st parent
div of img OK
but when this img is in a TD the parent returns undefined
then dont hides the div, how can i get the parent div with this?

$('[EMAIL PROTECTED]').click(function() {
alert($(this).parent("div").attr("id"));
  $(this).parent("div").hide();
  });
the begin of code

cellspacing="0">

 
   
   
   Ordem de Serviço 
   
   







On 5/30/07, Karl Swedberg <[EMAIL PROTECTED]> wrote:

Hi Jean,

Try switching the "=" and the "^" around. So, the selector  
expression should

look like this:
$('[EMAIL PROTECTED]')

That is, if you selecting all images that have a id that starts with
"fechar".




--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com





On May 30, 2007, at 10:22 AM, Jean Nascimento wrote:


I´m trying do that
$("[EMAIL PROTECTED]").click(function() {
alert('u can do it!');
 $(this).parent("div").hide();
 });
fechar = close

Even with a alert do nothing, where is wrong??

--

[]´s Jean
www.suissa.info

  Ethereal Agency
www.etherealagency.com




--

[]´s Jean
www.suissa.info

  Ethereal Agency
www.etherealagency.com




[jQuery] Re: Using close images

2007-05-30 Thread Jean Nascimento


Thanks dude.

On 5/30/07, Karl Swedberg <[EMAIL PROTECTED]> wrote:

Hi Jean,

Try switching the "=" and the "^" around. So, the selector expression should
look like this:
$('[EMAIL PROTECTED]')

That is, if you selecting all images that have a id that starts with
"fechar".




--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com





On May 30, 2007, at 10:22 AM, Jean Nascimento wrote:


I´m trying do that
$("[EMAIL PROTECTED]").click(function() {
alert('u can do it!');
 $(this).parent("div").hide();
 });
fechar = close

Even with a alert do nothing, where is wrong??

--

[]´s Jean
www.suissa.info

  Ethereal Agency
www.etherealagency.com




--

[]´s Jean
www.suissa.info

  Ethereal Agency
www.etherealagency.com


[jQuery] Re: Using close images

2007-05-30 Thread Jean Nascimento


I have other question, with this code i´m trying catch the 1st parent
div of img OK
but when this img is in a TD the parent returns undefined
then dont hides the div, how can i get the parent div with this?

$('[EMAIL PROTECTED]').click(function() {
alert($(this).parent("div").attr("id"));
  $(this).parent("div").hide();
  });
the begin of code


 
   
   
   Ordem de Serviço 
   
   







On 5/30/07, Karl Swedberg <[EMAIL PROTECTED]> wrote:

Hi Jean,

Try switching the "=" and the "^" around. So, the selector expression should
look like this:
$('[EMAIL PROTECTED]')

That is, if you selecting all images that have a id that starts with
"fechar".




--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com





On May 30, 2007, at 10:22 AM, Jean Nascimento wrote:


I´m trying do that
$("[EMAIL PROTECTED]").click(function() {
alert('u can do it!');
 $(this).parent("div").hide();
 });
fechar = close

Even with a alert do nothing, where is wrong??

--

[]´s Jean
www.suissa.info

  Ethereal Agency
www.etherealagency.com




--

[]´s Jean
www.suissa.info

  Ethereal Agency
www.etherealagency.com


[jQuery] Re: Using close images

2007-05-30 Thread Karl Swedberg

Hi Jean,

Try switching the "=" and the "^" around. So, the selector expression  
should look like this:

$('[EMAIL PROTECTED]')

That is, if you selecting all images that have a id that starts with  
"fechar".





--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On May 30, 2007, at 10:22 AM, Jean Nascimento wrote:



I´m trying do that
$("[EMAIL PROTECTED]").click(function() {
alert('u can do it!');
$(this).parent("div").hide(); 
});
fechar = close

Even with a alert do nothing, where is wrong??

--

[]´s Jean
www.suissa.info

  Ethereal Agency
www.etherealagency.com