Remove text caret/pointer from focused readonly input

后端 未结 7 1934
醉梦人生
醉梦人生 2020-12-13 06:26

I am using an , styled as normal text to remove the appearance of an interactive field, but still display the value.

7条回答
  •  离开以前
    2020-12-13 06:47

    The onfocus/blur method works ok to remove the cursor from a readonly field, but the browser does not automatically refocus on the next field, and you may lose focus altogether, which is not what the user usually expects. So, if this is required, you can use plain javascript to focus on the next field you want, but you have to specify the next field:

    
    

    Where 'NextField' is the name of the field to goto. (Alternatively, you could provide some other means to locate the next field). Obviously, this is more involved if you want to navigate to some non-visible UI element, like a tab-panel, as you will need to arrange this as well.

提交回复
热议问题