I have been making a threaded comment system as a way to learn php and javascript/jquery properly. Ive done bits and bobs in the past but ive made a new years resolution to learn it properly.
Im having trouble inserting a reply form into the comment tree below the comment being replied to. I know this is probably pretty basic but how do you insert html into a page when someone clicks a link.
This code wasn’t working for me:
$(document).ready(function(){ $(function() { $('a#reply').click(function() { $(this).append('the html blah'); }); }); });
Anyone see where im going wrong?
If none of the other suggestions are working, it could be your selector for the link is not working properly. In the example you provided you appear to be looking for a link like this:
Is that correct? You didn’t mention how you were generating the html, but I know with asp.net the server side id != the client side id and you would need to modify your selector like so:
In any case, here is a full example with html thats working fine for me: