How To Open Reply Form Under Comments Div
Solution 2:
$(function() { // if javascript code is before html
$('a.showReply').click(function(e){
$('#replymsgbox').slideToggle('fast')
});
});
Solution 3:
$("a.showReply").on("click", function(){
$(this).parent().parent().next().slideToggle("slow");
});
Here is the test: http://jsfiddle.net/2HczB/
I used with next() because I saw on your code you tried to do with this way. It's better to call immediately the id of the div. However with my solution you can open exactly the reply after the message you clicked reply.
Solution 4:
$('a.showReply').on("click", function(e){
$('#replymsgbox').slideToggle('fast')
});
You'll also need some padding or space between the two div
s to make sure the content doesn't overlap. In the example I just added a <br/>
.
Please note the change from .live
to .on
, as it is now deprecated.
See Here:
As of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers.
Make sure the document is ready as well by putting your jQuery code within $(document).ready(function{ ... })
. I'm sure you're probably already doing this and just pasted the relevant code, but always good to make sure.
Post a Comment for "How To Open Reply Form Under Comments Div"