Question: I am adding letters and words to an empty text area using the following code:

HTML:

```
<textarea id="Content"></textarea>

<button class="AddTo" value="a">a</button>

```

jQuery:

```
$('.AddTo').on('click', function() {
  $('#Content').append($(this).val());
});

```

How can I delete the last value added to the text area such as "a" or "apple" without clearing everything? Basically I want a delete button to remove the last character.

Answer: 
You need to keep track of the values inserted, you can use an array to do that as given below, then use that to remove the content 

```js
var values = [];
$('.AddTo').on('click', function() {
  values.push($(this).val());
  $('#Content').val($('#Content').val() + values[values.length - 1]);
});
$('.remove').click(function() {
  if (values.length) {
    $('#Content').val(function(i, v) {
      return v.slice(0, -values.pop().length)
    });
  }
})
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<textarea id="Content"></textarea>
<br />
<button class="remove">Remove</button>
<input type="button" class="AddTo" value="a" />
<input type="button" class="AddTo" value="apple" />
<input type="button" class="AddTo" value="some" />
<input type="button" class="AddTo" value="value" />
```
Well you could add your values like this:

```js
$('.AddTo').on('click', function() {
  $('#Content').append('<p> Some value </p>');
});

$('.Remove').on('click', function(){
  $('#Content p:last').remove();
  });
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button class="AddTo" value="Test">Add</button>
<button class="Remove">Remove</button>

<p id="Content"></p>
```

**Explanation:**

`#` referees for the id selector.

`$('#Contents p)` finds the p tag in the element with id Contents.

`$('#Contents p:last')` selects last p tag in the element with id Contents.

`.remove()` function removes it from the page.