Need action for X icon in search input

web
mobile

Topic: Need action for X icon in search input

jederrick pro asked 2 months ago

Expected behavior

I want to trigger an action for X icon in search input https://mdbootstrap.com/docs/jquery/forms/autocomplete/

Actual behavior

Right now X icon only clear the text in the input.

Resources (screenshots, code snippets etc.)

<div class="md-form">
  <input type="search" id="form-autocomplete" class="form-control mdb-autocomplete">
</div>

Arkadiusz Idzikowski staff answered 2 months ago

I'm not sure which MDB library do you use, because you added question to Angular section and provided link to jQuery documentation.

If this question is about MDB Angular autocompleter component, please take a look at the API section of our documentation (switch tab to API at the top of the page):

https://mdbootstrap.com/docs/angular/forms/autocomplete/

There is (clearButtonClicked) output that you can listen to. Just add this code to the autocomplete input element and create implementation for onClearButtonClick() method in your ts file:

(clearBtnClicked)="onClearButtonClick()"


Please insert min. 20 characters.
Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: Angular
  • MDB Version: 8.8.2
  • Device: PC
  • Browser: Chrome
  • OS: Ubuntu
  • Provided sample code: No
  • Provided link: Yes
Tags