Thanks to both of you... when I get back at this later in the week I'm going
to play with the various ideas and read up. I don't understand event
bubbling, but have heard the term enough times that I should dig in a bit.
The good (and bad) side of jquery is that I haven't had to really learn
javascript - I just jumped in. Little by little, with a little help from my
jquery friends :)

r.



Shawn-53 wrote:
> 
> 
> Understood.
> 
> I read the issue to be that when he clicked the link the row was 
> highlighting.  Whereas he wants to do something specific when the on the 
> link click, but highlight the row when the row is clicked.  In which 
> case both click events need to be independant (i.e. end).  The 
> stopPropagation() will do the trick, but I find a simple "return false" 
> is easier for folks to understand.  Especially those who do not really 
> understand or have experience with event bubbling.
> 
> But I think we are both right.  :)
> 
> Shawn
> 
> Erik Beeson wrote:
>> While returning false will stop the event from propagating, it will also 
>> prevent the default action from occurring, which isn't necessarily 
>> desirable. In this case it might not matter, but in general, 
>> event.stopPropagation () is the "right" way to stop the event from 
>> propagating. Returning false does both event.stopPropagation() and 
>> event.preventDefault().
>> 
>> --Erik
>> 
>> 
>> On 12/21/07, * Shawn* <[EMAIL PROTECTED] 
>> <mailto:[EMAIL PROTECTED]>> wrote:
>> 
>> 
>>     You probably need to return false from your click handlers
>> 
>>              // highlight rows, load details
>>             $("#myTable tr").mouseover(function() {
>>                     $(this).addClass("over");}).mouseout(function() {
>>                     $(this).removeClass("over");
>>             }).click(function(){
>>     $(this).addClass("thisRow").siblings().removeClass("thisRow");
>>                     var job = $(this).attr('id')
>>                     var details = (job + '.htm')
>>                     $("#console").load(details);
>>                     return false;
>>             });
>> 
>>             $("#myTable a.ackn").click( function(){
>>                     $(this).parents('tr').hide();
>>                      return false;
>>             });
>> 
>>     That *should* take care of things for you...
>> 
>>     Shawn
>> 
>>     rolfsf wrote:
>>      >
>>      > I've set up a simple action when a user clicks on a row in a
>> table.
>>      > (highlight the row, load some details via ajax into a div)
>>      >
>>      > However, in one column of the table I've got a link/button that,
>> when
>>      > clicked, will hide that row. If clicked, I don't want to
>>     highlight the row
>>      > or load it's details. How do I distinguish between the two?
>>      >
>>      >
>>      >       // highlight rows, load details
>>      >       $("#myTable tr").mouseover(function() {
>>      >               $(this).addClass("over");}).mouseout(function() {
>>      >               $(this).removeClass("over");
>>      >       }).click(function(){
>>      >              
>>     $(this).addClass("thisRow").siblings().removeClass("thisRow");
>>      >               var job = $(this).attr('id')
>>      >               var details = (job + '.htm')
>>      >               $("#console").load(details);
>>      >       });
>>      >
>>      >
>>      >       // hide a row after acknowledgement
>>      >       $("#myTable a.ackn").click( function(){
>>      >               $(this).parents('tr').hide();
>>      >       });
>>      >
>>      > thanks,
>>      > r.
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/clicking-on-row-vs.-clicking-on-link-in-that-row-tp14464501s27240p14475498.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to