开发者

Read-only input in Android Webkit not working

开发者 https://www.devze.com 2023-01-04 09:08 出处:网络
I have a text input field in my web page that I am using to collect a date (via the jQuery Tools .dateinput). The use开发者_JS百科r does not need to be able to type into the field. A dialog box appear

I have a text input field in my web page that I am using to collect a date (via the jQuery Tools .dateinput). The use开发者_JS百科r 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消