How to change the button name after click on it using ajax I am a newbie in drupal. I created a form that perform ajax action. How can I change the button name after click by using ajax.

function auktion_fav_form($form, &amp;$form_state, $auktion_id) { 
  form['add_to_fav'] = array(
    '#type' =&gt; 'submit',
    '#id' =&gt; 'submit',
    '#value' =&gt; t($value),
    '#ajax' =&gt; array(
      'callback' =&gt; 'auktion_fav_submit',
      'wrapper' =&gt; 'submit',
      'method' =&gt; 'replace',
      'effect' =&gt; 'fade',
    )
  );
  return $form;
}
function auktion_fav_form_submit($form, &amp;$form_state) {
  $form['add_to_fav']['#value'] = "remove from favourite;
  return $form['add_to_fav'];
}
In hook form alter define your submit value . Below is small piece of code .

   $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Calculate'),
     '#prefix' =&gt; '&lt;div id="div-example"&gt;',
     '#suffix' =&gt; '&lt;/div&gt;',
    '#ajax' =&gt; array(
        'callback' =&gt; 'example_ajax_form_callback',
        'wrapper' =&gt; 'div-example',
         'method' =&gt; 'replace',
      ),
     );

function example_ajax_form_callback($form, &amp;$form_state) {
  $form['submit']['#value'] = 'New value';
    return $form['submit']; 
  }