Mr Shawn Posted September 29, 2011 Share Posted September 29, 2011 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 Link to comment Share on other sites More sharing options...
justsomeguy Posted September 29, 2011 Share Posted September 29, 2011 Are you trying to do that with Javascript? Link to comment Share on other sites More sharing options...
Mr Shawn Posted October 1, 2011 Author Share Posted October 1, 2011 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();};});}); Link to comment Share on other sites More sharing options...
justsomeguy Posted October 3, 2011 Share Posted October 3, 2011 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. Link to comment Share on other sites More sharing options...
Mr Shawn Posted October 3, 2011 Author Share Posted October 3, 2011 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. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 3, 2011 Share Posted October 3, 2011 I'm not sure, I don't work with jQuery much. I'm sure you can find that in their documentation. Link to comment Share on other sites More sharing options...
thescientist Posted October 5, 2011 Share Posted October 5, 2011 the each method might help you herehttp://api.jquery.com/jQuery.each/ Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.