using javascript to change some text into an input field when clicked on

前端 未结 3 510
有刺的猬
有刺的猬 2020-12-24 08:39

I\'m trying to make a page that has some editabable fields, but I only want them to display as input boxes once the user clicks on them (the rest of the time showing as plai

3条回答
  •  伪装坚强ぢ
    2020-12-24 09:12

    Can we do it simple guys?

    Just keep textbox with readonly property true and some CSS which makes text box looks like span with border.

    Then as soon as user clicks on text box remove readonly attribute.

    On blur restore the CSS and readonly attributes.

提交回复
热议问题