I am coding an app using jQuery, jqTouch and phonegap and have run across a persistent problem which arises when a user submits a form using the Go button on the soft keyboard.
Although it is easy to get the cursor to move to the appropriate form input element by using $('#input_element_id').focus()
, the orange outline highlight always returns to the last input element on the form. (The highlight does not show up when the form is submitted using the form submit button.)
What I need is to find a way either to disable the orange highlight completely or else make it move to the same input element as the cursor.
So far, I have tried adding the following to my CSS:
.class_id:focus {
outline: none;
}
This works in Chrome but not on the emulator or on my phone. I have also tried editing the jqTouch theme.css
to read:
ul li input[type="text"] {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); and
-webkit-focus-ring-color: rgba(0, 0, 0, 0);
}
With no effect.
I have also tried each of the following additions to the AndroidManifest.xml
file:
android:imeOptions="actionNone"
android:imeOptions="actionSend|flagNoEnterAction"
android:imeOptions="actionGo|flagNoEnterAction"
None of which have any effect.
Update: I have done some more troubleshooting with this and to date have found:
The outline property works only on Chrome, not on the Android browser.
The
-webkit-tap-highlight-color
property does in fact work on the Android browser, though not on Chrome. It disables the highlight on focus as well as on tapping.The
-webkit-focus-ring-color
property does not seem to work on either browser.
To make sure the
tap-highlight-color
property overriding works for you, consider these things first:This case works for Android from v2.3 to v4.x even in a PhongeGap application. I tested it on Galaxy Y with Android 2.3.3, on Nexus 4 with Android 4.2.2 and on Galaxy Note 2 with Android 4.1.2. So don't define it for states only for the element itself.
Use the below code in CSS file
It's work for me. I hope it work for you.
If the design doesn't use outlines, this should do the job:
This didn't work for me on Image Map Area links, the only working solution was to use javascript by capturing the ontouchend event and preventing default browser behavior by returning false on the handler.
with jQuery:
I have tried this one and worked fine :-
HTML:-
css
Try: