Escape values for key HTML elements

HTML elements are generated from plain text, but values are not escaped
properly. This gives wrong HTML and prevents rows from being properly
updated if using row ids with apostrophes