HTML5问题 - 字段类型 - 尝试以编程方式更改它

时间:2011-03-08 20:42:50

标签: html5 mobile

我正在开发移动HTML5应用程序。

我有一个type="number"字段,然后基于另一个字段值,我想将Field的类型更改为“text”。这会更改屏幕键盘。我正在使用

document.getElementById('daField').type = "text";

有时它可以在其他时间保持数字。就好像我需要将焦点从那个区域移开然后再回来。

有人有什么想法吗?

由于

1 个答案:

答案 0 :(得分:0)

试试这个:

document.getElementById('otherInput').focus();
document.getElementById('daField').type = "text";
document.getElementById('daField').focus();