get textbox value and display

by lemon kazi

HTML

<input type="text" class="price">
    <br><br>
    <h2></h2>

JavaScript

var $input = $('.price');

 $input.on('focus', function(e) {
      this.calculationDone = false;
    }).on('change', function(e) {
      if (!this.calculationDone) {
        calculationDone = true;
        $('h2').text($(this).val());
        console.log('done');
        //do other calculation
      }
    }).on('keyup', function(e) {
        if(e.which != 13) return;
        e.preventDefault();
        $(this).trigger('change');
    })