문제

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);
};
도움이 되었습니까?

해결책

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. :)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top