Pregunta

Why don't both of my prompts work? If I delete the second prompt, the first prompt occurs on page load (as desired). The second prompt never works (even if I delete the first prompt). Someone, please save me! :-)

// first prompt

var answerOne = prompt("Question?");

$('h1').text(answerOne);

// second prompt

$('#someID').on('click', function() {
    var answerTwo = prompt("Another question?");
    $('h1').text(answerTwo);
};
¿Fue útil?

Solución

Last characters (the last line of your js code :)

}; 

should be

});

If You would open up Firebug or Console in other debugger you would saw that. :)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top