Created
June 13, 2016 15:39
-
-
Save kodamirmo/2b981dd81382d5b5dd837ed37bd12355 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mensajes = [ | |
{ | |
mensaje : 'Hola mundo', | |
persona : 'Jose Lopez', | |
}, | |
{ | |
mensaje : 'Hola', | |
persona : 'Andra Lamas' | |
}, | |
{ | |
mensaje : 'Irving', | |
persona : 'Andra Lamas' | |
}, | |
{ | |
mensaje : 'Contestame!!', | |
persona : 'Jose Lopez' | |
}, | |
{ | |
mensaje : '¿Me odias?', | |
persona : 'Jose Lopez' | |
}, | |
]; | |
var conversacion = 'Andra Lamas'; | |
$(document).ready(function() { | |
console.log(':D'); | |
for (var i =0; i< mensajes.length; i++){ | |
var temp = mensajes[i]; | |
if (conversacion == temp.persona){ | |
$('#contenedor').append(temp.persona); | |
$('#contenedor').append('<br>'); | |
$('#contenedor').append(temp.mensaje); | |
$('#contenedor').append('<br><br><br>'); | |
} | |
} | |
$('#input').keypress(function(event){ | |
//Si se presiono enter | |
var texto = $('#input').val(); | |
var quien = $('#caja').text(); | |
var temp = { | |
mensaje : texto, | |
persona : quien | |
}; | |
mensajes.push(temp); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment