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: 
how about the following? 

```js
var str = "here goes some text";
var lastIndex = str.lastIndexOf(" ");
str = str.substring(0, lastIndex);
$("div").text(str);
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<div></div>
```
A simple solution is to create a backspace button that removes the last character from the text:

```
$('#Backspace').click(function() {
  $('#Content').text(function (_,txt) {
    return txt.slice(0, -1);
  });
});

```