How to set ajax event to onkeypress event? $form['name'] = array(
        '#type' =&gt; 'textfield',
        '#title' =&gt; t('Name'),
        '#size' =&gt; '27',
        '#inline' =&gt; 'true',
        '#required' =&gt; TRUE,
        '#prefix' =&gt; '&lt;div id="ajax-link"&gt;',
        '#suffix' =&gt; '&lt;/div&gt;&lt;div id="ajax-display"&gt;&lt;/div&gt;',
        '#ajax' =&gt; array(
          'effect' =&gt; 'fade',
          'callback' =&gt; 'ajax_textfield_callback',
          'wrapper' =&gt; 'ajax-display',
          'event' =&gt; 'onkeypress',   /////////////////Want to add event
        ),
    );


Here in example i have to add event (slashed location). By Default it takes on change event. I want to change that event to onkeypress event.
See this link.

You can specify any valid jQuery event.

So, you need to change 'onkeypress' to 'keypress'.