.change event question

.change event question

Hi

The following script adds a value of '3' to the rDecision field if the domain in the email address is gmail.com etc. This works when you click the button, but I would like the value to be added without having to click on the button. I understand this is done with .change but I'm not sure how? Can anyone help? Thanks

  1. <script>
    function checkEmail() {
     
        var email=$('#txtEmailID').val();
        var filter = /^([\w-\.]+@(?!gmail.com)(?!yahoo.com)(?!live.com)(?!hotmail.com)([\w-]+\.)+[\w-]{2,4})?$/
     
        if (!filter.test(email)) {
        jQuery("#rDecision").val(3).change();

        return false;
     }
      else{
      alert('Nice!..you have entered valid email address');
      }
    }
    </script>

    <input type='text' id='txtEmailID'/>
    <button type="button" onclick="checkEmail()">Validate Mail</button>
    <input type='text' id='rDecision'/>

Thanks