im not exactly sure what i would be listening for, i get the error in
firebug that deleteitem doesn't exist. I understand the concept of how
to use on other elements but im not sure how this would be used on my
submit function

On Jul 13, 11:17 pm, "Kevin Pepperman" <[EMAIL PROTECTED]> wrote:
> For dynamicly loaded elements you will need to use a plugin.
>
> I suggest the 'listen' plugin.
>
> Refer to the FAQ for more information.
>
> http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_st...<https://mail.google.com/mail/#inbox/11b1f57192f17027>
>
>
>
> On Sun, Jul 13, 2008 at 9:46 PM, Tom Shafer <[EMAIL PROTECTED]> wrote:
>
> > I am using this code to add a new item to a list
>
> > $("#addLinks").submit(function()
> > {
>
> >        $.post("addLinks.php",{ step:'addLink',title:$
> > ('#title').val(),url:$('#url').val(),pageID:$('#pageID').val()} ,
> >        function(data)
> >        {
> >                        $('#'+$('#pageID').val()).
> >                        append("<li id='link_'"+data+"><a
> > href='javascript://'
> > id='delete' onclick='deleteitem("+data+"); return false;'><img
> > src='img/delete.gif' /></a><h1>"+$('#title').val()+"</h1><p>"+$
> > ('#url').val()+"</p></li>");
> >                        $('#link_'+data).effect("pulsate", { times: 3 },
> > 1000);
>
> >        });
> >       return false;
> > });
>
> > as you can see i am adding <a href='javascript://' id='delete'
> > onclick='deleteitem("+data+"); return false;'><img src='img/
> > delete.gif' /></a>
> > to delete the newest dom element.
>
> > this works on page refresh but I would like it to work right after
> > someone added the dom element
>
> > here is what i am using to delete data from the database and the
> > element that goes along with the delete item
>
> > function deleteitem(id) {
> >        $(function() {
> >                $.post("addLinks.php",{ step:'deleteLink',linkId:+id});
> >                        $('#link_'+id).remove();
>
> >     });
> > }
>
> > $('#link_'+id).remove();  removes the item after a page refresh. How
> > can it the element be removed without a page refresh after being added
>
> > thanks
>
> > -tom
>
> --
> Fred Allen  - "Television is a medium because anything well done is rare."

Reply via email to