I have a jquery code that hides and shows an answer ... but when I paste it several times to activate several answers it stops working, code:
<a href='#' id='alternar-respuesta-ej1' style='float: left; color: #ff0000;'>Mostrar respuesta</a><div id='respuesta-ej1' style='display:none'>-- RESPUESTAS--</div>
and the jquery code, which I've pasted several times (more than 30 times) in different script tags as the conversation ends.
// jQuery
$(document).ready(function(){
$('#alternar-respuesta-ej1').toggle(
// Primer click
function(e){
$('#respuesta-ej1').slideDown();
$(this).text(' ocultar respuestas ');
e.preventDefault();
}, // Separamos las dos funciones con una coma
// Segundo click
function(e){
$('#respuesta-ej1').slideUp();
$(this).text('mostrar respuesta');
e.preventDefault();
}
);
});