Kar*_*lus 5 javascript text transform textinput helpers
我如何创建诸如:
- 有一些文本
- 我点击它
- 它转换为包含我点击的文本的输入。
<a href="#" onclick="var input = document.createElement('input'); input.setAttribute('value', this.firstChild.nodeValue); this.parentNode.replaceChild(input, this);">here is some text</a>. Click it.
Run Code Online (Sandbox Code Playgroud)
相反,<a>您也可以使用<span>或<div>任何您喜欢的东西。