Transition from JavaScript alerts to jAlert?

Transition from JavaScript alerts to jAlert?

Hi! I'm working on a quiz-like game for a website.

You enter letters into separate fields to spell a word. If the word is right, you get a "congratulations" dialogue; if it's not, the dialogue tells you how many letters you have right out of how many total letters there are.

However, the standard JavaScript alert isn't ideal in this situation for two reasons:
  1. I need to insert a link to the next question if your answer is correct.
  2. A lot of browsers enable you to turn off dialogues after a certain number of them have appeared from the same page, which would render the game unplayable.
I've decided that switching to jAlert / the jQuery Dialog UI would be the best way to remedy this, but I can't seem to make it work.

This is what that section of my original code looked like:
  1.     if(correctAnswers == totalQuestions) {
  2.         alertText = "Congratulations! That's the right answer!";
  3.      }
  4.      else {
  5.         alertText =  "Not quite! You've got " + correctAnswers + " out of " + totalQuestions + " correct letters!";
  6.      }
  7.      alert(alertText);
And this is how I tried to implement jAlert:
  1.       if(correctAnswers == totalQuestions){
  2.         $("#submit").click( function() {       
  3.             jAlert("Congratulations! That's the right answer!");
  4.      }
  5.      else {
  6.      $("#submit").click( function() {  
  7.             jAlert( "Not quite! You've got " + correctAnswers + " out of " + totalQuestions + " correct letters!");
  8.      }
I've also tried this, but to no avail:
  1.  $("#submit").click( function() {   
  2.       if(correctAnswers == totalQuestions){    
  3.             jAlert("Congratulations! That's the right answer!");
  4.      }
  5.      else {
  6.             jAlert( "Not quite! You've got " + correctAnswers + " out of " + totalQuestions + " correct letters!");
  7.      }

What happens in response to the last two sets of code is... well, nothing. I click on the submit button, and where the plain JS would create the dialogue, nothing happens.

Does anyone know what I'm doing wrong that could help me sort this out? Thanks!