I had to do kind of a hack when I tried to stop propagation...here's how I
did it, maybe it will help you.
$(".togglecell").click(function(e) {
var tag = (e.target) ? e.target.tagName : e.srcElement.tagName;
if (tag == 'TR') {
// do your click stuff here
}
});
-- Josh
----- Original Message -----
From: "barophobia" <[EMAIL PROTECTED]>
To: <jquery-en@googlegroups.com>
Sent: Wednesday, June 20, 2007 1:54 PM
Subject: [jQuery] Re: Help with stopping event propagation.
I don't quite understand.
As you can see in the code I posted, there are no submit buttons in
the <tr> that has the event bound to it so I'm not sure what your
example is trying to show me.
Are you suggesting that I need to specifically negate the action of an
event on everything that I don't want it to happen on???
Chris.
On 6/20/07, Alexandre Plennevaux <[EMAIL PROTECTED]> wrote:
You may be looking after event.stopPropagation();
$("form").bind("submit", function(event){
event.stopPropagation();
});
http://docs.jquery.com/Events
-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of barophobia
Sent: mercredi 20 juin 2007 8:41
To: jquery-en@googlegroups.com
Subject: [jQuery] Help with stopping event propagation.
(I saw another email come through but not this one and it's been about 30
minutes since I originally sent. Apologies if you see this twice.)
Hi.
I am applying a click() event to a <tr> but I only want the event to fire
if
someone clicks on empty space or plain text. With the help of the IRC
channel I've only been able to get the click event to stop working on a
form
element but nothing else.
Anyone have any ideas?
Here's my JS:
$('tr.customer').click( function(e) {
if($(e.target).is(":input")) return; // this works
if($(e.target).is(":input, a")) return; // this doesn't work
if($(e.target).is("a")) return; // this doesn't work
if($(e.target).is(":a")) return; // this doesn't work
// get the customer's id
customer_id = $(this).attr('customer_id');
alert('you clicked me! my number is '+customer_id+'!'); });
Here's my HTML:
<tr class="customer is_admin" customer_id="1">
<td class="checkbox">
<input type="checkbox" name="customer_id[]" value="1"/>
</td>
<td class="name">
<a href="customers_add.php?customer_id=1">Chris</a>
</td>
<td class="delete">
<a href="javascript:alert('not yet!')">
<img src="../lib/admin/img/delete.png"/>
</a>
</td>
</tr>
Thanks!
Chris.
Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.472 / Base de données virus: 269.9.1/854 - Date: 19/06/2007
13:12