I have a simple problem (hopefully), but I am unable to find a clear solution.

I have a datatable, which has a text input field. The user enters text into the text field, and hits the enter key. This automatically filters from the text entered.

I was hoping to use the onkeyup event to trigger so when a user enters a value in the text field, the datatable automatically updates, rather than the user having to press enter.

```
<input type="text" name="input" class="filter" id="input" onkeyup="functionName(this)" value="">

<script>
function functionName(e) {
alert(e.value);
}
</script>

```

This code works, so when I enter a value, it pops an alert up displaying the entered value.

Is it possible i can change the alert, to do a submit, or replicate what the "enter" key does.

From trying to find a solution, it is more difficult because it is not a form, as it uses ajax so the .submit methods will not work.

I was also hoping a solution like this could work

```
<script>

var e = jQuery.Event("keyup");
e.which = 13; // Enter
$("#input").trigger(e);

</script>

```

I know there are many similar topics, and I have looked, but none of them seem to be the right solution for me.
Thanks for the help.

//

Edit

//

Based on the keyup issue, how can I refocus cursor after filtering. Is this done at the same time as filtering? 

```
        $obj.find('input.filter').on('keyup',function(e){
               e.preventDefault();
               ajax($obj);
        });

```