jqeury hide row

i have a list of comments i have added a remove link to each . i would like when you click the remove link for the row containing the comment will disappear.


this the code i have so far it is not working..


  $('.remove').click(function(){      
            $(this).parents().each(function() {
            var valueClass = $(this).attr("class");
            if(valueClass=='remove_row'){
                  var cidValue = $(this).find(".cid").val();
                $.post('../main/post_remove.php',{cid:cidValue},
                     function(ress){
                      $('#tester').html('good');
                 $(this).slideToggle("slow");                   
                   });
              }
        });
  return false;
  });      
 });
LVL 4
tdotAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

StealthyDevCommented:
can you please share your html code snippet also?
0
tdotAuthor Commented:
This is a peace of the code i have cutted out a view of the posts...........




<tr class="remove_row"><td height="40" valign="top"><table width="510" align="left"class="left_topb">
                     <tr>
                         <td width="36" rowspan="3" align="center" valign="top"><a href="profile.php?viewed_id=51"><img class="imgb"
                          src="http://www.tdothot.com/pics/pics_085gal_1.jpeg" /></a></td>
                         <td width="386" valign="top"  ><span class="user_style">poppi</span><span class="comment_style">im testing out the site  relax for a bit</span></td>
                         <td width="72" height="18" colspan="2" valign="top" bgcolor="#FFFFFF" class="ctr"> <a href="#" class="remove">Remove</a></td>
                 <input class="cid" type="hidden" value="109" />

                         </tr>
                     <tr>
                         <td valign="top" ><img src="../images/date.png"><span class="wrote_style">Wrote on </span>
                         <span class="com_date_style">February  26th 2010 at 10:24 am</span></td>
                         <td height="26" colspan="2" valign="top" class="style791">&nbsp;</td>
                       </tr>
                       </table></td></tr><tr class="remove_row"><td height="40" valign="top"><table width="510" align="left"class="combtm">
                     <tr>

                         <td width="36" rowspan="3" align="center" valign="top"><a href="profile.php?viewed_id=51"><img class="imgb"
                          src="http://www.tdothot.com/pics/pics_085gal_1.jpeg" /></a></td>
                         <td width="386" valign="top"  ><span class="user_style">poppi</span><span class="comment_style"></span></td>
                         <td width="72" height="18" colspan="2" valign="top" bgcolor="#FFFFFF" class="ctr"> <a href="#" class="remove">Remove</a></td>
                 <input class="cid" type="hidden" value="98" />
                         </tr>
                     <tr>
0
StealthyDevCommented:
This will work:



$('.remove').click(function(){      
            $(this).parents().each(function() {
            var valueClass = $(this).attr("class");
            if(valueClass=='remove_row'){
		var thisobject = $(this);
                  var cidValue = $(this).find(".cid").val();
                $.post('../main/post_remove.php',{cid:cidValue},
                     function(ress){
                      $('#tester').html('good');
                 //$(this).slideToggle("slow");                   
		 thisobject.slideToggle("slow");                   
                   });
              }
        });
  return false;
  });      
 });

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

tdotAuthor Commented:
could you explain why you had to put $this into variable. Why could  i not just access $this inside the post call back function...
0
tdotAuthor Commented:
isn't $this already global why did i need to create a new global var to contain it..
0
StealthyDevCommented:
because you are moving to another function (inner) after the response of the ajax page. so "this" object will now pick the body of the page.
0
tdotAuthor Commented:
Well done senthurpandian an excellent answer for a problem i found very difficult.....
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.