Jump to content
Mr Shawn

How To Move All Comment Replies Under The Ones Replied To?

Recommended Posts

Here is the location of the comments I need help with on my scrap Blogger/blogspot blog. I'm trying to move the replies under the ones they reply to. 1. I want to move the reply starting from the <li> node it is in, then 2. place it in a <ul> tag with the class "children" inside of the <li> node of which the comment replies to 3. I also want to remove the <a>reply</a> from the moved comment(s) Help me please :(

Share this post


Link to post
Share on other sites
Are you trying to do that with Javascript?
I got it done with jquery and javascript, but it only works on the first <li class="comment"> of the comment area. I want it to do the same for each. Here is the code that only works for the first one.
$(document).ready(function() {  var a = $("li.comment").attr("id");  var b = $("li.comment[id='"+a+"']");  var c = $("li.comment > div.comment-body div > p > a").attr("href");  var d = $("li.comment > div.comment-body div > p > a[href='"+c+"']");  var e = document.createElement("ul");jQuery.each(["#"+a==c], function() {  if("#"+a==c) {	$(e).addClass("children").appendTo(;	d.parents("li.comment").appendTo(e);	$("li ul li div.reply").remove();};});});

Edited by Mr Shawn

Share this post


Link to post
Share on other sites

When you get the variable a you're only getting the ID of one element. You should get all comments elements and loop through them.

Share this post


Link to post
Share on other sites
When you get the variable a you're only getting the ID of one element. You should get all comments elements and loop through them.
How do I do that? I'm still new to this.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...