I have created a form that has a submit button.

$form['products_submit'] = array(
    '#type' => 'submit',
    "#id"  => "submit_first",
    '#value' => t('Submit'),
    '#ajax' => array(
                'callback' => 'products_submit_driven_callback',
                'method' => 'replace',
                'effect' => 'fade',
                'progress' => array('type' => 'none'),
            '#prefix' => '<div class="button-logged-in">',
        '#suffix' => '</div>'

  return $form;

And I want to add an image inside the button, at the left of 'Submit' text. I tried to add the img tag inside the t function but it just showed the code and not the image. Does anyone know how can I manage this?


1 Answer 1


You can handle this from CSS.

Like :

    background-image: url(/images/buttons/submit.png);

Example : https://stackoverflow.com/questions/2920076/html-css-how-to-add-image-icon-to-input-type-button

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.