Firing ajax_callback on textfield after a minimum number of character Ive created a textfield with an ajax callback with 'keyup' event.

In need the callback function to be fired only after a certain number of character ... 
I can control the number of character of the input in the callback function, but this is not the way I want it...

There's maybe a javascript way to avoid the callback to be fired before 5 character ?

My form field :

        $form['myitem'] = array(
          '#type' =&gt; 'textfield',
          '#size' =&gt; 6,
          '#maxlength' =&gt; 5,
          '#default_value' =&gt; '',
          '#name' =&gt; "my_name",
          '#disabled' =&gt; FALSE ,
            '#ajax' =&gt; array(
                'callback' =&gt; 'mymodule_mycallback_ajax_callback',
                'wrapper' =&gt; "mywrapper", 
                'method' =&gt; 'replace',
                'event' =&gt; 'keyup',
                'progress' =&gt; array('message' =&gt; NULL),
            ),
        );
One option is to use a custom jQuery event, eg. something like "startajaxCall". Set $form['my_input']['#ajax']['event'] = 'startajaxCall' and provide some JS to trigger your custom event after an appropriate number of keys is entered.