[jQuery] Re: click function doesn't work on dynamic content?

2008-06-06 Thread Jon Reed

Might be worth looking into the livequery plugin too

J

On Jun 6, 1:43 am, Richard D. Worth [EMAIL PROTECTED] wrote:
 Take a look at:

 http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_st...

 If I've understood you're problem, it's a fairly common one that stems from
 the fact that you're adding a new element (with append('li ...) that has
 no click event bound to it. The article linked above has a full explanation
 and some good solutions.

 - Richard

 Richard D. Worthhttp://rdworth.org/

 On Thu, Jun 5, 2008 at 7:31 PM, [EMAIL PROTECTED] [EMAIL PROTECTED]
 wrote:



  Hi there,

  Please see my example here:http://www.hellobenlau.net/jquery/test.htm

  So basically, I want to select a list item from Group A, and when the
  transfer button is clicked, it gets transfered to Group B.
  However, once transferred, the list items in Group B doesn't respond
  to any click function called OUTSIDE of the 'transfer' function.

  Im not sure if i'm explaining it properly, but this is my code:
  $(document).ready(function(){

                 var temp;

                 // selecting
                 $('li').click(function(){
                         $('li.highlight').removeClass('highlight');
                         $(this).addClass('highlight');
                         temp = $(this).text();
                 });

                 // when transfer link is clicked
                 $('#transfer').click(function(){
                         $('#groupA li.highlight').remove();
                         $('#groupB').append('li' + temp + '/li');
                 });
         });

  Any help would be extremely helpful!

  Thanks!!


[jQuery] Re: click function doesn't work on dynamic content?

2008-06-06 Thread Ariel Flesler

That article in the FAQ does mention LiveQuery.

--
Ariel Flesler
http://flesler.blogspot.com

On 6 jun, 05:56, Jon Reed [EMAIL PROTECTED] wrote:
 Might be worth looking into the livequery plugin too

 J

 On Jun 6, 1:43 am, Richard D. Worth [EMAIL PROTECTED] wrote:



  Take a look at:

 http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_st...

  If I've understood you're problem, it's a fairly common one that stems from
  the fact that you're adding a new element (with append('li ...) that has
  no click event bound to it. The article linked above has a full explanation
  and some good solutions.

  - Richard

  Richard D. Worthhttp://rdworth.org/

  On Thu, Jun 5, 2008 at 7:31 PM, [EMAIL PROTECTED] [EMAIL PROTECTED]
  wrote:

   Hi there,

   Please see my example here:http://www.hellobenlau.net/jquery/test.htm

   So basically, I want to select a list item from Group A, and when the
   transfer button is clicked, it gets transfered to Group B.
   However, once transferred, the list items in Group B doesn't respond
   to any click function called OUTSIDE of the 'transfer' function.

   Im not sure if i'm explaining it properly, but this is my code:
   $(document).ready(function(){

                  var temp;

                  // selecting
                  $('li').click(function(){
                          $('li.highlight').removeClass('highlight');
                          $(this).addClass('highlight');
                          temp = $(this).text();
                  });

                  // when transfer link is clicked
                  $('#transfer').click(function(){
                          $('#groupA li.highlight').remove();
                          $('#groupB').append('li' + temp + '/li');
                  });
          });

   Any help would be extremely helpful!

   Thanks!!- Ocultar texto de la cita -

 - Mostrar texto de la cita -


[jQuery] Re: click function doesn't work on dynamic content?

2008-06-05 Thread Richard D. Worth
Take a look at:

http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_Ajax_request.3F

If I've understood you're problem, it's a fairly common one that stems from
the fact that you're adding a new element (with append('li ...) that has
no click event bound to it. The article linked above has a full explanation
and some good solutions.

- Richard

Richard D. Worth
http://rdworth.org/

On Thu, Jun 5, 2008 at 7:31 PM, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:


 Hi there,

 Please see my example here: http://www.hellobenlau.net/jquery/test.htm

 So basically, I want to select a list item from Group A, and when the
 transfer button is clicked, it gets transfered to Group B.
 However, once transferred, the list items in Group B doesn't respond
 to any click function called OUTSIDE of the 'transfer' function.

 Im not sure if i'm explaining it properly, but this is my code:
 $(document).ready(function(){

var temp;

// selecting
$('li').click(function(){
$('li.highlight').removeClass('highlight');
$(this).addClass('highlight');
temp = $(this).text();
});

// when transfer link is clicked
$('#transfer').click(function(){
$('#groupA li.highlight').remove();
$('#groupB').append('li' + temp + '/li');
});
});

 Any help would be extremely helpful!

 Thanks!!