SoFunction
Updated on 2025-04-07

Easily implement ionic calling keyboard search function using JS (super practical)

This requirement is provided by the product. At the beginning, it was just set <input style="padding-top: 3px;" type="search" placeholder="Search for doctors or hospitals" ng-model="query">

type="search"

I found that I couldn't get search on Android, which was so angry that I got the conclusion after searching on Google. I needed to apply a form form outside. So I added it to the event submitted by the form form and directly called the button button click event ng-click="searchSelect()". There is no need to listen to the search keyboard click event, which saves a lot of trouble. It is indeed very practical. I am really a genius.

The html code is as follows:

&lt;form&gt;
&lt;div class="bar bar-header item-input-inset" style="height: 50px;"&gt;
&lt;label class="item-input-wrapper" &gt;
&lt;i class="icon ion-ios-search" style="position: relative;color: gray;font-size: 1.5em;top: 1px;"&gt;&lt;/i&gt;
&lt;input style="padding-top: 3px;" type="search" placeholder="Search for a doctor or hospital" ng-model="query"&gt;
&lt;/label&gt;
&lt;button class="button button-clear" style="color: #49B746;" ng-click="searchSelect()">Search</button>&lt;/div&gt;
&lt;/form&gt;

The js code is as follows:

$ = function(){
if ($ == 'hospital'){
}else{
$();
}
};

The above is what the editor introduced to you using JS to easily implement the ionic keyboard search function (super practical) and hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!