Content-based backup and replacement

I am working on an application that will have a list of previously saved data. if you have a typo, do not enter all data points initially, etc., you will have the opportunity to edit the data block.

right now I have javascript getting the values ​​of each element (which was created through the foreach loop in php with data from the server) within this fragment, storing it in the object and then replacing these elements ( <p>) with textarea, then filling it with data from the object js that captured him earlier.

for one, I have problems escaping quotes from dynamic content, but it also seems like this might not be the most elegant solution.

included satisfactory.

basically: should I go along this route and just make each of the elements in the data block contenteditable = 'true' by clicking the "edit" button or is it too suspicious with browser support?

Is my current course a solid plan?

or is there a third (fourth, fifth, etc.) option?

thank!

+5
source share
2 answers

If you don’t need a user to edit HTML content (or complex hilighting syntax, etc.), go to the / textarea input solution. Much cleaner, much lighter and lighter. Contenteditable gets complicated very quickly, and using something like minyMCE or similar is likely to be redundant.

+5
source

JSfiddle, , . , . jQuery , (Snippet, jquery-syntaxhighlighter).

+1

All Articles