Mobile end input pops up the keyboard with the search button and gets the event triggered by clicking the Search button

Source: Internet
Author: User

First of all say how the user clicks on input with the search button to pop the keyboard, in fact, very simple, plus type= "search" can be.


<input id= "keyword" placeholder= "input keyword search"  type= "Searching"/>

Effect Chart:

Then how to get the Search button click event, the code is as follows:

$ ("#keyword"). On (' KeyPress ', function (e) {
                var keycode = E.keycode;
                var Searchname = $ (this). Val ();
                if (keycode== ') {
                    e.preventdefault ();  
                    Request Search Interface

After the comment plus the event you want to add, it's OK. Can alert ("test"); try it!

Explain, the computer side is also available, at this time will not eject the keyboard, the physical keyboard of the role of the ENTER key equivalent to the search button.

This very simple but very practical tips for everyone, to enhance the user experience just, like please reprint ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.