Re: jquery clone and live

Wednesday, May 9, 2012

The .live is used for dynamic DOM elements that are added after the initial load of the page.  However, with jQuery 1.7 (I believe that's the latest), you can do as so:

$('.current_editor .edit').on({
     'click': function () {
           //do stuff here;
     }
});

See if that takes away you having to double click it.  Also, if you can provide a link, someone might be able drill down to the real issue if this doesn't solve it.

-Nathan



On Wed, May 9, 2012 at 7:37 AM, Curious <ovidiu.alexa@gmail.com> wrote:
Hello.

I'm working on a project that involves clone, sortable and live.

Basically there's a table which is sortable and there is a button that
adds another row to the sortable table. Every row has 2 buttons: edit
and delete. If I perfom a sortable action (drag and drop) and then I
click on any button (edit or delete) nothing happens.

$('.current_editor .edit').live('click', function () {
//do stuff here;
});

However, when I click on the same button a second time it works. This
is somewhat random because it happens only on the row that was
dragged.

Is it better to use live or just call a function with
onclick="my_function('id')" ?

And how about the live thingy? Shouldn't it scan the dom for any
selector?

It would be helpful if someone could give me an answer.

Thank you in advance.

--
You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To post to this group, send email to javascript-information@googlegroups.com.
To unsubscribe from this group, send email to javascript-information+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javascript-information?hl=en.


--
You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To post to this group, send email to javascript-information@googlegroups.com.
To unsubscribe from this group, send email to javascript-information+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javascript-information?hl=en.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Copyright © 2010 Web Design | Free Blogger Templates by Splashy Templates | Layout by Atomic Website Templates

Vida de bombeiro Recipes Informatica Humor Jokes Mensagens Curiosity Saude Video Games Animals Diario das Mensagens Eletronica Rei Jesus News Noticias da TV Artesanato Esportes Noticias Atuais Games Pets Career Religion Recreation Business Education Autos Academics Style Television Programming Motosport Humor News The Games Home Downs World News Internet Design Entertaimment Celebrities 1001 Games Doctor Pets Net Downs World Enter Jesus Mensagensr Android Rub Letras Dialogue cosmetics Genexus lasofia thebushrajr wingshock tripedes gorduravegetal dainfamia dejavu-transpersonal jsbenfica republicadasbadanas ruiherbon iranianforaryans eaystcheyl fotosdanadir Só Humor Curiosity Gifs Medical Female American Health Madeira Designer PPS Divertidas Estate Travel Estate Writing Computer Matilde Ocultos Matilde futebolcomnoticias girassol lettheworldturn topdigitalnet Bem amado enjohnny produceideas foodasticos cronicasdoimaginario downloadsdegraca compactandoletras newcuriosidades blogdoarmario arrozinhoii