Question: all i have li elements.In all li elements i have a button with same id.So what i am trying to do is that when i click that button in any li element, the text of that button should change

```
       <ul>
           <li><span class="yes_button"></span></li>
           <li><span class="yes_button"></span></li>
           <li><span class="yes_button"></span></li>
           <li><span class="yes_button"></span></li>
       </ul>

       $(".yes_button").click(function(){
         $(".yes_button").text("no");        
       })

```

the problem i am having is that when click any button the text changes in all buttons present in different li elements

Answer: 
Another solution is:

```js
$(".yes_button").click(function() {
  $(this).text(function(i, text) {
    return text === "yes" ? "no" : "yes";
  })
});
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul>
  <li><span class="yes_button">yes</span></li>
  <li><span class="yes_button">yes</span></li>
  <li><span class="yes_button">yes</span></li>
  <li><span class="yes_button">yes</span></li>
</ul>
```
use this

```
 $(".yes_button").click(function(){
     $(this).text("no");        
  })

```