How to add “on change” to a text input in contact form7?

The CF7 plugin does not give you access to the HTML markup formatting function of the field tags. So you need to capture the JavaScript event fired when the field is changed. To do this you can tag a script at the end of your form,

<label>[text* name id:name]</label>
<label>[text* surname id:surname]</label>
[submit]
<script>
(function($){
'use strict';
  $(document).ready( function(){
    $('form.wpcf7-form :input').change(function(e){
      var $field = $(e.target);
      switch($field.attr('name')){
        case 'name': //text field name was changed.
          //do something.
          break;
        case 'surname': //text field surname was changed.
          //do something.
          break;
      }
    })
  })
})(jQuery)
</script>