1

I have PHP page where users can upload photos (using Ajax & PHP script). Those uploaded photos (thumbs) are shown after upload in DIV below upload field.

Then, after hitting send button I want to clone that DIV at that same page at message board, bellow other messages with or without uploaded photos.

When I try to do that with:

var pht = $("#photos").clone().addClass('p_pht');

and try to display sent photos bellow sent message like this:

$("div#wall").append('<div class=msg>'+ message +'</div><div class=n_pht>'+ pht +'</div>');

I get jQuery error message "[object Object]" in place where the photos should be displaying.

What am I doing wrong?

1 Answer 1

6

Try

pht.html() instead of pht.

$("div#wall").append('<div class=msg>'+ message +'</div><div class=n_pht>'+ pht.html() +'</div>');

If message is also a jQuery object then give message.html().

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. But now I have a problem with jquery plugin "fancybox" (for displaying images). It does not work if I try to call it like: var pht = $("#photos").clone().fancybox(); What is the problem with this plugin?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.