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
<div id="container_formulario">
<table width="550" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td width="64" background="macosx/images/top_bg.png">
<img src="macosx/images/bttns.png" width="33" height="24" /></td>
<td align="center" background="macosx/images/top_bg.png"
class="title">Ordem de Serviço </td>
<td width="58" align="right" background="macosx/images/top_bg.png">
<img src="imgs/icons/up_icon.png" name="min_max" width="16"
height="16" class="Hover" id="min_max" />
<img src="imgs/botao_fechar.png" alt="Fechar" name="fechar_form"
width="16" height="16" border="0" id="fechar_form" class="Hover" />
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