Hi,

I have a page that opens up an iframe for the user to be able to
select photos.  Each photo has a checkbox, and on select I add a
hidden form element to the parent frame form.  This all seems to work
fine, but im now stuck on how to remove the form element when the
checkbox is un-checked.

Heres what I have:

        $(document).ready(function(){

                 $(':checkbox.addPhoto').click(function(){
                        if ($(this).attr('checked')) {
                                // Add element to form
                                $("#post", parent.document.body).append("<input 
type='hidden'
name='Photos[]' value='" + $(this).attr('id') + "' />");
                        } else {
                                // Delete element from form
                                $("#post", parent.document.body).remove("<input 
type='hidden'
name='Photos[]' value='" + $(this).attr('id') + "' />");
                        }
                });

        });


Using "Append" works great for adding, however im not sure how to go
about the removal.  Above I am trying to use "remove" but this fails.

Can anyone advise on how I would delete a string from a form on the
parent frame?

Best regards, Ben.

Reply via email to