[jQuery] Re: function running 2X

2009-07-29 Thread András Csányi

2009/7/29 marksimon zen...@gmail.com:

 Any idea why this would run twice:
 function clickcharges() {
        $('#cardcharges tr td').click(function() {
        alert('execute once');

         });
 }

Stupid idea, but maybe... Because the td tag is part of the tr. And if
you click the cell once means that one click on the cell and one click
on the row... :)

-- 
- -
--  Csanyi Andras  -- http://sayusi.hu -- Sayusi Ando
--  Bízzál Istenben és tartsd szárazon a puskaport!.-- Cromwell


[jQuery] Re: function running 2X

2009-07-29 Thread marksimon

no stupid ideas here, but changing to $(#cardcharges td).click( didn't
fix the problem.

On Jul 29, 11:22 am, András Csányi sayusi.a...@gmail.com wrote:
 2009/7/29 marksimon zen...@gmail.com:



  Any idea why this would run twice:
  function clickcharges() {
         $('#cardcharges tr td').click(function() {
         alert('execute once');

          });
  }

 Stupid idea, but maybe... Because the td tag is part of the tr. And if
 you click the cell once means that one click on the cell and one click
 on the row... :)

 --
 - -
 --  Csanyi Andras  --http://sayusi.hu-- Sayusi Ando
 --  Bízzál Istenben és tartsd szárazon a puskaport!.-- Cromwell


[jQuery] Re: function running 2X

2009-07-29 Thread Eric Garside

Pretty sure its because the event is bubbling up. Try:

$('#cardcharges td').click(function(){
alert('execute once');
return false;
});

On Jul 29, 2:38 pm, marksimon zen...@gmail.com wrote:
 no stupid ideas here, but changing to $(#cardcharges td).click( didn't
 fix the problem.

 On Jul 29, 11:22 am, András Csányi sayusi.a...@gmail.com wrote:



  2009/7/29 marksimon zen...@gmail.com:

   Any idea why this would run twice:
   function clickcharges() {
          $('#cardcharges tr td').click(function() {
          alert('execute once');

           });
   }

  Stupid idea, but maybe... Because the td tag is part of the tr. And if
  you click the cell once means that one click on the cell and one click
  on the row... :)

  --
  - -
  --  Csanyi Andras  --http://sayusi.hu--Sayusi Ando
  --  Bízzál Istenben és tartsd szárazon a puskaport!.-- Cromwell


[jQuery] Re: function running 2X

2009-07-29 Thread marksimon

Still getting 2 alerts.

On Jul 29, 11:49 am, Eric Garside gars...@gmail.com wrote:
 Pretty sure its because the event is bubbling up. Try:

 $('#cardcharges td').click(function(){
 alert('execute once');
 return false;

 });

 On Jul 29, 2:38 pm, marksimon zen...@gmail.com wrote:

  no stupid ideas here, but changing to $(#cardcharges td).click( didn't
  fix the problem.

  On Jul 29, 11:22 am, András Csányi sayusi.a...@gmail.com wrote:

   2009/7/29 marksimon zen...@gmail.com:

Any idea why this would run twice:
function clickcharges() {
       $('#cardcharges tr td').click(function() {
       alert('execute once');

        });
}

   Stupid idea, but maybe... Because the td tag is part of the tr. And if
   you click the cell once means that one click on the cell and one click
   on the row... :)

   --
   - -
   --  Csanyi Andras  --http://sayusi.hu--SayusiAndo
   --  Bízzál Istenben és tartsd szárazon a puskaport!.-- Cromwell


[jQuery] Re: function running 2X

2009-07-29 Thread John Resig
How many times is clickcharges called? Perhaps you're binding a click more
than once.
--John


On Wed, Jul 29, 2009 at 3:03 PM, marksimon zen...@gmail.com wrote:


 Still getting 2 alerts.

 On Jul 29, 11:49 am, Eric Garside gars...@gmail.com wrote:
  Pretty sure its because the event is bubbling up. Try:
 
  $('#cardcharges td').click(function(){
  alert('execute once');
  return false;
 
  });
 
  On Jul 29, 2:38 pm, marksimon zen...@gmail.com wrote:
 
   no stupid ideas here, but changing to $(#cardcharges td).click( didn't
   fix the problem.
 
   On Jul 29, 11:22 am, András Csányi sayusi.a...@gmail.com wrote:
 
2009/7/29 marksimon zen...@gmail.com:
 
 Any idea why this would run twice:
 function clickcharges() {
$('#cardcharges tr td').click(function() {
alert('execute once');
 
 });
 }
 
Stupid idea, but maybe... Because the td tag is part of the tr. And
 if
you click the cell once means that one click on the cell and one
 click
on the row... :)
 
--
- -
--  Csanyi Andras  --http://sayusi.hu--SayusiAndo
--  Bízzál Istenben és tartsd szárazon a puskaport!.-- Cromwell



[jQuery] Re: function running 2X

2009-07-29 Thread Brett Ritter

On Wed, Jul 29, 2009 at 3:03 PM, marksimonzen...@gmail.com wrote:

 Still getting 2 alerts.

You show your .click() function in another...is that wrapping function
getting called more than once?  If so, the action is getting bound
more than once.

-- 
Brett Ritter / SwiftOne
swift...@swiftone.org


[jQuery] Re: function running 2X

2009-07-29 Thread marksimon

Got it. Thanks all. I was calling it twice. Fixed that and it's fine
now.

On Jul 29, 12:12 pm, Brett Ritter swift...@swiftone.org wrote:
 On Wed, Jul 29, 2009 at 3:03 PM, marksimonzen...@gmail.com wrote:

  Still getting 2 alerts.

 You show your .click() function in another...is that wrapping function
 getting called more than once?  If so, the action is getting bound
 more than once.

 --
 Brett Ritter / SwiftOne
 swift...@swiftone.org