Take the 2-minute tour ×

Is there a way to remove a DIV based on it's custom attribute comment_id?

I have the following code but it does not quite work yet.

<script type="text/javascript">
    $('.delete_comment').live('click', function() {
        // Url we request data from
        $.get( "http://www.site.com/pages/delete/user_comment.php",
        // Url parameters to send 
        // Output data from php file generated by PHP echo.
            var comment_id = $(this).attr('comment_id').val();
            if (comment_id == data) {




share|improve this question
What seems to be the problem with doing this ? Why doesn't it work ? –  Shrayas Oct 3 '11 at 6:20
You should accept answers to your other questions, to motivate others to help you. This is how things are going on here –  Marek Sebera Oct 3 '11 at 6:23
sorry man. I don't quite see the Accept button. I'll be happy to. –  Vini Oct 3 '11 at 6:25
@Vini please continue with accepting answers in all your previous questions, may help attract more clever people than am I to your questions ;-) –  Marek Sebera Oct 3 '11 at 9:22
add comment

1 Answer

up vote 12 down vote accepted

Yes, possible


share|improve this answer
could you kindly repost my code with your update? –  Vini Oct 3 '11 at 6:21
Vini: no, I don't have a clue what your code is doing and what should it be doing. I just gave you proper answer to your question. –  Marek Sebera Oct 3 '11 at 6:22
My code is removing a div called comment with a custom attribute called comment_id based on this custom attribute comment_id. –  Vini Oct 3 '11 at 6:29
I hardly recommend you to identify comments by id or class attributes, to be valid with (X)HTML DocType –  Marek Sebera Oct 3 '11 at 6:31
Yes, it is possible. Just don't expect us to do your work. –  Marek Sebera Oct 3 '11 at 6:46
add comment

Your Answer


