I'm trying to save an answer, but I can not, every time I refresh the previous answer back. Here's what I'm trying to implement:
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="utf-8">
<title>question and answer</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script><style></style></head><body><p>WhatisthecapitalofBrazil?</p><pid="resposta">
Rio de Janeiro
</p>
<script>
$(function () {
$("p").dblclick(function () {
var conteudoOriginal = $(this).text();
$(this).addClass("respostaEmEdicao");
$(this).html("<input type='text' value='" + conteudoOriginal + "' />");
$(this).children().first().focus();
$(this).children().first().keypress(function (e) {
if (e.which == 13) {
var novoConteudo = $(this).val();
$(this).parent().text(novoConteudo);
localStorage.content = $('#resposta').html();
$('#resposta').html(localStorage.content);
$(this).parent().removeClass("respostaEmEdicao");
}
});
$(this).children().first().blur(function(){
$(this).parent().text(conteudoOriginal);
$(this).parent().removeClass("celulaEmEdicao");
});
});
});
</script>
</body>
</html>
What am I doing wrong?