I have a webpage with text input and monospaced font:
<input type="text" style="font-family: monospaced">
And this works like a charm on Android. But when I enter the "edit" mode on the device, when the keyboard pops up, the font changes back to the platfom specific one (not monospaced). When the editing is done and text field loses focus, it changes back to monospaced again.
The idea here is to change the text manipulation font to monospaced also when editing the text. Is there a way to do it from within HTML / CSS / Javascript? My first impression is "no", as this seems to be platform defined in the underlying TextView. But maybe my impression is wrong.
Are you talking about an embedded WebView. Then it is possible.
You could add a javascript interface in Android. Then in your javascript you could add an event listener on the input fields, which will use the javascript interface to trigger an action on the native app. This action could also be changing the font-family of native components.
Related
I'm aware there are multiple input types that force different keyboard layouts on mobile devices. Is there an input type or other attribute that will force the input to open to emoji keyboard on focus?
I don't believe there is, as emoji is technically another language keyboard. But I'd love outside validation to make sure this is the case.
You can't for now, there was an issue on github about that : https://github.com/w3c/html/issues/495
i am creating a web page for mobile devices. In that there are few input fields which require user to always enter data in uppercase.
I looked at few options like
text-transform property of css
It changes user input to uppercase but it also changes the placeholder. That doesn't looks good.
autocapitalize attribute for input
By setting it on, it allows keyboard to open in caps. But this doesn't seems to work for me. It works perfectly with textarea but not with input in android.
Is there any better way to achieve this?
try adding autocapitalize="characters" to input, it worked for me on Android, and it should work on other kind of devices as MDN web docs says here:
The autocapitalize attribute doesn’t affect behavior when typing on
a physical keyboard. Instead, it affects the behavior of other input
mechanisms, such as virtual keyboards on mobile devices and voice
input.
You should be able to bind to a keydown or keypress event (I'd use jQuery) and modify the input.
It won't affect the soft keyboard; maybe you can use this along with autocapitalize?
So just to add some more information for future users, here is an example where all displayed text will be in caps and the virtual keyboard will also show in all caps.
Note that custom keyboards like swift apparently do not work but the builti in ones do.
Changes are done through inputProps
<TextField
name={props.name}
value={props.val}
inputProps={{autocapitalize:"characters", textTransform:"uppercase"}}
onChange={props.doStuff}
/>
I'm aware that questions have been asked and answered about the Android soft keyboard and which buttons it shows by default, and in what circumstances, and how to modify them.
However, all the answers involve changing the Java code. Since I am writing a cross-platform app using Phonegap and jQueryMobile, I'd like to stay away from learning Java.
My problem is this:
I have a form with (in this order, in abbreviated html):
<form action='javascript:processSubmit()'>
<select id='expenseType'/>
<input type='text' id='expenseAmount'/>
<select id='expenseDate'/>
<button type='submit'/>
</form>
What currently happens is that the soft keyboard will appear once I press the text input field. So far so good. The button in the bottom right corner of the soft keyboard says 'Next'. But pressing it does not shift the focus to the next form field. And when the user has clicked on the second select and picked a value, the keyboard button does not change to 'Done'.
Is there not a way to give the fields some special html attribute to make the magic happen?
Or a Javascript way to change the softkeyboard?
AFAIK, there is no way from JavaScript or HTML to affect the behavior of the Android soft keyboard.
I know that is a very old question, but with this plugin https://github.com/driftyco/ionic-plugin-keyboard you can change this behaviour with the Keyboard.hideKeyboardAccessoryBar method
I am using CKEditor as a rich text WYSIWYG Javascript editor.
I would like to add an on-screen keyboard so that they can easily enter text from non-English alphabets.
I was planning on finding a JavaScript on-screen keyboard and adding a custom button with a CKEditor plug-in to trigger it.
I've found a couple of JavaScript on-screen keyboards. I like the one that Google provides best. The problem is that it needs to be bound to an HTML <textarea>. As far as I can tell CKEDitor uses an iFrame and has no <textarea>. Does anyone have any ideas for how to work around this problem? Is there a way I can bind the keyboard to the CKEditor "<textarea>"? Or is there an on-screen keyboard that doesn't need to be bound to anything?
Thanks!
You can try this one
http://debugger.ru/demo/projects/virtualkeyboard/richedit/ckeditor/plugins/Jsvk/examples/sample.html
There you'll see development release, but shortly it will be replaced with production one.
Project page: http://sf.net/prokects/jsvk/
I have a text input field in my web page that I am using to collect a date (via the jQuery Tools .dateinput). The user does not need to be able to type into the field. A dialog box appears when the field is clicked on. This is a problem on my Motorola Droid, because I don't want the soft-keyboard to appear when the field is clicked.
I have tried input.blur() on focus and also setting the field to disabled and readonly. Setting the field to disabled has undesired side effects. Setting the field to readonly works in everything but the Android browser. The browser seems to recognized the "readonly" attribute (or readOnly via javascript), BUT the field does not actually become readonly. When you click it, the soft keyboard still appears and allows you to change the field.
I suppose that this is a bug in the Android browser. Can anyone come up with a clever alternative?
I used a workaround - since I didn't need to actually edit in the input field (like you, I was popping a date picker), I changed to a span with similar styling. The code is kind of trivial once you have the trick, and it's really app specific so I don't have any really for you to see.