title: Jquery click to open modal returns " undefined is not a function"
body: <p>I'm trying to open a modal on a mouse click but i can't seem to get it to work at all. Here is my code</p>
  
  <pre><code>&lt;script src="~/Scripts/jquery-1.10.2.min.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/jquery-ui-1.10.4.custom.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      $("#Attack1Id").click(function () {
          var location = $.find("#dialog");
          $(location).dialog({
              title: "Dialog box",
              height: 300,
              modal: true,
              open: function (event, ui) {
                  $(this).load("@Url.Action("FileTables", "Card")");
              },
              on: ('click', '.table a', function () {
                  alert($(this).closest('tr').find('td:first').text())
              })
          })
      });
  &lt;/script&gt; 
  </code></pre>
  
  <p>It would seem "dialog" is the undefined function, but how else am i suppose to create a jquery dialog?</p>
  
  <p>Update</p>
  
  <p>Just for clarity this is my whole html page</p>
  
  <pre><code>@model CardSite.Models.Card
  
  &lt;script src="~/Scripts/jquery-1.10.2.min.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/jquery-ui-1.10.4.custom.min.js"&gt;&lt;/script&gt;
  
  @{
      ViewBag.Title = "Card";
  }
  
  &lt;h2&gt;New card type&lt;/h2&gt;
  
  @using (Html.BeginForm("CreateCard", "Card", FormMethod.Post))
  {
      @Html.AntiForgeryToken()
  
      &lt;div class="form-group"&gt;
          @Html.LabelFor(m =&gt; m.Name)
          &lt;div class="text-box-for"&gt;
              @Html.TextBoxFor(m =&gt; m.Name)
          &lt;/div&gt;
          @Html.LabelFor(m =&gt; m.Attack1Id)
          &lt;div class="text-box-for"&gt;
              @Html.TextBoxFor(m =&gt; m.Attack1Id)
          &lt;/div&gt;
  
          &lt;div id="dialog"&gt;&lt;/div&gt;
  
      &lt;/div&gt;
  
      &lt;input type="submit" value="Create" class="btn btn-default" /&gt;
  }
  
  
  
  &lt;script type="text/javascript"&gt;
  
      $(document).ready(function () {
          $("#Attack1Id").click(function () {
              var location = $.find("#dialog");
              $(location).dialog({
                  title: "Dialog box",
                  height: 300,
                  modal: true,
                  open: function (event, ui) {
                  },
                  on: ('click', '.table a', function () {
                      alert($(this).closest('tr').find('td:first').text())
                  })
              })
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>--- Update ---</p>
  
  <p>I just updated my code to look like this</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
      $(document).ready(function () {
          $("#Attack1Id").click(function () { 
              $("#dialog").dialog({
                  title: "Dialog box",
                  height: 300,
                  modal: true,
                  open: function (event, ui) {
                      $(this).load("@Url.Action("FileTables", "Card")");
                  },
                  on: ('click', '.table a', function () {
                      alert($(this).closest('tr').find('td:first').text())
                  })
              });
          });
      });
  
      $(document).ready(
              $("#dialog").dialog({
                  title: "Dialog box",
                  height: 300,
                  modal: true,
                  open: function(event, ui) {
                      $(this).load("@Url.Action("FileTables", "Card")");
                  },
                  on: ('click', '.table a', function(){
                      alert($(this).closest('tr').find('td:first').text())
                  })
              })
          );
  &lt;/script&gt;
  </code></pre>
  
  <p>and the modal works, it appears at the start of the page, i can close and then click on the input box and it appears again. But if I close the modal, re-open the modal and then click on view, it does two alerts, like it has created more than one... any ideas on how to fix this?</p>