Sapna Agrawal
Sapna Agrawal

Reputation: 117

How to append a child as second last. (Just before last)

I have an application, Just you can imagine as Facebook comment system, where post, Comments for that post, and new Text area for post your comment is available.

Example -

post1.. All comments for that post.. text area for new comment
post2.. All comments for that post.. text area for new comment
post3.. All comments for that post.. text area for new comment

. .

My problem is while i post a new comments its get appended after the text area. I want to post the comment at just before text area, along with all comments. How should i use the JQuery append method to achieve this functionality.

Thanks in advance. Sapna

You can refer this url.. http://wowopage.in/cgi-bin/requests.pl Try to response to any requests you will get the exact problem. To provide response you must be logged-in. Please use my credentials. [email protected] and passs- sapna

Upvotes: 0

Views: 440

Answers (2)

John x
John x

Reputation: 4031

you have not provided any markup so its very hard to guess ... anyhow you can use

.before

to append what ever before the textarea

http://api.jquery.com/before/

Upvotes: 0

scessor
scessor

Reputation: 16115

Select the textarea and use jQuery before. E.g.:

$('#post1 textarea').before(stringWithNewComments);

(Because you haven't post your whole html the selector is only an example and you have to update it.)

Upvotes: 2

Related Questions