Remove disabled attribute onClick of disabled form field

后端 未结 10 1457
眼角桃花
眼角桃花 2020-12-03 11:28

I have a form field that starts out disabled and has an onClick to enable it. The onClick doesn\'t fire (at least in FF) nor does a simple alert(1);.

The hacky vers

10条回答
  •  萌比男神i
    2020-12-03 12:01

    If you simply want to prevent the user from typing data in your field, but instead want the field to populate on an event, my hack solution was to not disable the input field at all, but instead after running my onclick or onfocus functions, to call blur() so the user can not edit the field.

提交回复
热议问题