Skip to content

How to remove disable attribute from a button in form-mini

I’m trying to remove disable from a button in form-mini.phtml but couldn’t find a way through jquery/javascript. I know it gets enabled after adding a few characters, but by default, it remains disabled.

As I’m creating my own theme from scratch, I want that disabled attribute to be removed at all times for now.

<button
   type="submit"
   title="<?= $escaper->escapeHtml(__('Search')) ?>"
   class="action search"
   aria-label="Search"
>
   <span><?= $escaper->escapeHtml(__('Search')) ?></span>
/button>

I tried by $('.action.search').removeAttr("disabled") and $('.action.search').prop('disabled', false) but couldn’t find any luck.

When I removed type="submit" from the button, the disabled removed as well. And I got an error TypeError: Cannot set properties of undefined (setting 'disabled') from Magento. So I guess it’s somehow connected to type="submit".

I was wondering if there is a way to manipulate the javascript of form-mini.phtml as well or what would be the better way to achieve this.

Please, any help would be appreciated.