title: Alert showing when the page is loaded when I only want onclick
body: <p>I have a bookmarking system and when a image is bookmarked I want an alert with an image to confirm that a image is bookmarked.</p>
  
  <p>I have a working alert and onclick it shows the alert. However, the alert also shows when the page is loaded. I can't figure out how to only show the alert when the form is submitted</p>
  
  <p>The code:</p>
  
  <pre><code>&lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /&gt;
  &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
  &lt;script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"&gt;&lt;/script&gt;
  
            &lt;!--form which sends field information to the database--&gt;
            &lt;form class="form" id="form" action="" method="post" &gt;
              &lt;img id="enlargedSymbol" type="text" size="60" name="pathOfSymbol" src='' /&gt; &lt;!--large symbol where source is inserted--&gt;
                  &lt;br /&gt;
                  &lt;!--hidden input which value is set by query where then its sent to the database--&gt;
                  &lt;input class="inputBox" type="hidden" name="pathOfSymbol" id="pathOfSymbol" /&gt;
                        &lt;script&gt;
                        var querySrc = URI(window.location.href).search(true).src; //gets image source
                        //sets image source as enlarged symbol
                        $("#enlargedSymbol").prop("src", querySrc);
                        //sets path of symbol as hidden value
                        $('#pathOfSymbol').val(querySrc);
                        &lt;/script&gt;
  
                          &lt;button type="submit" name="submit" id="addToBookmarksButton" onclick="addedToBookmarks()"  &gt;
                              &lt;img id="addToBookmarksButton" src="img/addToBookmarks.png"  /&gt;
                          &lt;/button&gt;
  
  
                &lt;/form&gt;
  
  
                &lt;script&gt;
                $(function addedToBookmarks () {
                  $("#dialog").dialog();
                });
                &lt;/script&gt;
  
                &lt;div id="dialog"&gt;
                  &lt;img src="img/addToBookmarks.png" alt="Placeholder Image" /&gt;
                &lt;/div&gt;
  </code></pre>