I'm not an expert in jquery, I've been using for a couple of week. So, sorry if my question seems obvious for you.

I have created a jquery script which works fine. 

```
<script>
    $(document).ready(function() {
        $("#comment<?php echo $data['id']; ?>").click(function(e) {

            $("#comment<?php echo $data['id']; ?>").prop('disabled', true);

            if ($("#comment<?php echo $data['id']; ?>").val() == 'Comment') {

                $.ajax({
                    type: "POST",
                    url: "<?php echo Yii::app()->createUrl('comment/create', array('post_id' => $data['id'])); ?>",
                    success: function(data) {
                        $("#comment<?php echo $data['id']; ?>").after(data);
                        $(".form").slideDown(2000);
                    }                          
                });
            } else {

                $.ajax({
                    type: "POST",
                    url: "<?php echo Yii::app()->createUrl('comment/delete', array('post_id' => $data['id'], 'user_id'=> Yii::app()->user->id)); ?>",
                    success: function(data) {
                        $("#comment<?php echo $data['id']; ?>").prop('disabled', false);
                    }
                });
            }
</script>

```

I would like to replace  

all `$("#comment<?php echo $data['id']; ?>")` by `$(this).` 

When I do it, it doesn’t work as expected. For example in the if statement, 

`$("#comment<?php echo $data['id']; ?>").val() == 'Comment'`

it goes to the else part and run the delete action instead of create

\* New information

my button in html page contains the following

```
<p><input type ="button" id="comment<?php echo $data['id']; ?>" 
     value="<?php echo isset($comment_exist) ? 'Comment' : 'Cancel my Comment'; ?>"></p>

```

Thank you in advance for your help