On Dec 8, 7:47 pm, ricardobeat <[EMAIL PROTECTED]> wrote:
> According to the LiveQuery documentation (http://brandonaaron.net/docs/
> livequery) the 'registerPlugin' functionality is for plug-ins that
> modify the DOM without the aid of jQuery, which is not your case. I
> believe you'd have to bind an event to the a.delete elements for that
> to work:
>
> function confirm() {
>         return window.confirm("Are you sure you want to " +
> this.innerHTML.toLowerCase() + "?");
>
> };
>
> jQuery(document).ready(function($) {
>     $('a.delete').livequery('click',confirm);
>     $('a.ajax').click(function(){
>         $(this).parent().append('<p><a href="#"
> class="delete">Delete</
> a></p>');
>         return false;
>     });
>
> });
>
> if you want to keep your confirm() as a plugin, this might work but is
> much more complicated and adds extra overhead:
>
> $.fn.confirm = function() {
>    $(this).data('confirm_plugin',true);
>     this.click(function() {
>         return window.confirm("Are you sure you want to " +
> this.innerHTML.toLowerCase() + "?");
>     });
>
> };
>
> jQuery(document).ready(function($) {
>     $('a.delete').livequery('mouseenter',function(){
>        if (!$(this).data('confirm_plugin')) $(this).confirm().click();
>     });
>     $('a.ajax').click(function(){
>         $(this).parent().append('<p><a href="#"
> class="delete">Delete</
> a></p>');
>         return false;
>     });
>
> });
>
> Alternatively you could simply call confirm() after every append.

   Thanks a lot for your kind reply. I'm still hoping for a short
jQueryish approach for it. If anyone got any idea on this, kindly
share. TIA

--
  <?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com    Blog: http://rajeshanbiah.blogspot.com/

Reply via email to