I don't get it why is this not working properly:

[Fiddle](https://jsfiddle.net/ze5tsgy9/1/)

I just want to show the tax amount but it gets `false` results.

```
// calculate brutto and tax
$(document).on('keyup paste', '#netto', function() {
    var brutto = $("#brutto").val();
    var netto = $("#netto").val();
    $("#brutto").val(netto * 1.19);
    $("#tax").val(brutto - netto);
});

```
['https://Stackoverflow.com/questions/41160023', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2502731/']
The problem is that you get the brutto value before filling it, the solution is to get `var brutto` after you calculate `$("#brutto").val(netto * 1.19)`:

```js
// calculate brutto and tax
$(document).on('keyup paste', '#netto', function() {
    var netto = +$("#netto").val();
    $("#brutto").val(netto * 1.19);
    var brutto = +$("#brutto").val();
    $("#tax").val(brutto - netto);
});
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="form-group">
    <label for="brutto">Brutto</label>
    <input class="form-control" readonly="readonly" name="brutto" type="text" id="brutto">
</div>
<div class="form-group">
    <label for="tax">Taxes 19%</label>
    <input class="form-control" readonly="readonly" name="tax" type="text" id="tax">
</div>
<div class="form-group">
    <label for="netto">Netto</label>
    <input class="form-control" name="netto" type="text" id="netto">
</div>
```
You need to validate the value of `brutto` element is a number before performing operation. the `+` operator is use to convert input to a number. 

```
$(document).on('keyup paste', '#netto', function() {
    var brutto = +$("#brutto").val() || 1;
    var netto = +$("#netto").val() || 1;
    brutto = netto * 1.19;
    $("#brutto").val(brutto);
    $("#tax").val(brutto - netto);
});

```

This will also be useful since the element is readonly.
[Updated Fiddle](https://jsfiddle.net/satpalsingh/ze5tsgy9/5/)