Search code examples
javascriptiphoneandroidhtmlkeypad

iphone "Go" key pad button and android "Enter" keypad button


I have a site which is optimized for mobile devices. I also have a sign in page on this site. Once a user fills the credentials he/she can sign in using a sign in button. but I also want that the same operation happen when they tab the "Go" button or "Enter" button on the key pad.

how can we implement that?

the other thing also, on iPhone how you can change the key pad type that pop up when a text field is active? I know if you want to get a number key pad you set the type="tel" for the tribute of the input tag.

how about for the other types of key pads?

tanx


Solution

  • For the first part - a standard <input type="submit"/> will be activated by default when the "Go"/"Enter" button will be pressed, as with the "Enter" key will work on a desktop browser.

    For other special input types, there are those:

    <input type="email">
    <input type="url"><!-- web address -->
    <input type="number" min="0" max="10" step="2" value="6"><!-- dial -->
    <input type="range" min="0" max="10" step="2" value="6"><!-- slider -->
    <input type="search"><!-- quess what? -->
    

    They are documented well on Dive Into HTML5 page.

    Important: remember that <input> elements have to be enclosed inside a <form> to work!