There are multiple span tags in the page, and each span tag is bound to a double-click event. How to implement it in the double-click event, so that the span tag that is double-cheeked becomes an input tag, and the value in the span tag becomes The value of the input tag?
1. It’s easy to do with the help of
html5
的新特性contenteditable
and Angular’s instructions.2. You can watch this demo
3. The specific code is as follows:
app.js
index.html
ng-dbclick quality can be processed
Generally speaking, write two, one to hide and one to show:
Although it is not good to change the requirements casually...but I guess what you want is actually that the input before double-clicking is read-only and has no borders. After double-clicking, it changes from read-only to editable with borders...
Like before Add double-click response as several people said, and change readonly and style in the callback function.