What are the cons of using a contentEditable div rather than a textarea?

后端 未结 3 1134
离开以前
离开以前 2020-12-29 18:22

Would I be shooting myself in the foot by using a div with attribute contentEditable=\"true\" as a text field rather than a textarea?

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-29 18:24

    It would work fine, but it'd be a little bit more difficult than a form, simply because you're going to have to wire up your own logic to make the button's click event track down the correct div, get its content, and then perform the submission. The advantage of a textarea is that the browser takes care of all that for you.

提交回复
热议问题