> 
> **Possible Duplicate:**  
> 
> [jQuery: select an element’s class and id at the same time?](https://stackoverflow.com/questions/1944302/jquery-select-an-elements-class-and-id-at-the-same-time) 
> 
> 
> 

when I have this ajax call to a function, I need to update a div with a class and a certain id:

```
        $(function() {
        $(".click-follow").click(function() {

            var user_id = "<?=$id?>";
            var id = $(this).attr('title');
            var dataString = 'user_id=' + user_id + '&id=' + id;

            $.ajax({
                type: "POST",
                url: "/ajax/follow.php",
                data: dataString,
                }).done(function( result ) {
                    myresult(result);
            });

            return false; 
        });
    });

function myresult(result) {
var result_lines = result.split("<splitter>");    
if (result_lines[0] == '1') {
    $('.click-follow').html(result_lines[1]).fadeIn(500);
    $('.follow').html(result_lines[2]).fadeIn(500); 
} else if (result_lines[0] == '2') { 
    $('.click-follow').html(result_lines[1]).fadeIn(500); 
    $('.follow').html(result_lines[2]).fadeIn(500); 

}
return true;   

```

}

So I want to use the var id in the function myresult, for example:

```
    $('.click-follow#' + id).html(result_lines[1]).fadeIn(500);

```

For example: I have 3 divs:

```
 <div class="click_follow" id="1"></div>
 <div class="click_follow" id="2"></div>
 <div class="click_follow" id="3"></div>

```

when I click div 1, I also want to update div 1. But I don't know how to use the var id in the function I call after the ajax call. The problem is that the amount of div's is not know... so it can be 20 div's or 2...