title: jquery check if text has been deleted from input field
body: <p>I am using bootstrap typeahead. When a user enters an address into a form, a dropdown displays with possible addresses. When they select one, I add a hidden input field with the id of the address from database. </p>
  
  <p>Now when the user removes texts from the input field, well that address is no longer valid, so I want to remove that hidden input field. The problem is how do I detect when a user deletes text from the input field using delete key or using mouse.</p>
  
  <p>I've already tried keypress event, it does not work when using delete key:</p>
  
  <pre><code>var input_changed = false
  $('#myid').bind('typeahead:selected', function(obj, datum, name) {
      $.ajax({
          url: "/lead_profiles/populate_address",
          data: {
              address : datum
          }
          // dataType: "script"
      }).done(function(data){
          var contact = JSON.parse(data)[0];
          var $parent = $("#myid").closest(".form-group");
          $parent.after('&lt;input name="lead_profile[contact_attributes][id]" type="hidden" value="' + contact.id + '"&gt;')
          input_changed = true
      });
  });
  
  $("#myid").on('keypress', function(){
    if(input_changed){
        alert("Input has changed");
    }
  })
  </code></pre>
  
  <p>I need another event besides keypress to determine if text has been removed from input field.</p>