title: Script does not work with $(document).ready(function() {}
body: <p>Im working on an ASP.NET MVC application.
  Im trying to create a dialog window with jQuery UI. But, whenever I add <code>$(document).ready(function() {}</code> to my code, it doesnt work anymore.
  Here is my code:</p>
  
  <pre><code>$(document).ready(function() {
      $("#loginContainer").dialog({
          width: 340,
          height: 340,
          resizable: false,
          show: {
              effect: "fade",
              duration: 500
          },
          hide: {
              effect: "fade",
              duration: 500
          }
      });
  
      $(".openLogin").click(function () {
          $("#loginContainer").dialog("open");
      });
  });
  </code></pre>
  
  <p>And here are the bundles I've added</p>
  
  <pre><code>public static void RegisterBundles(BundleCollection bundles)
  {
      bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                   "~/Scripts/jquery-1.10.2.js"));
  
      bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                  "~/Scripts/jquery-ui-1.10.4.js",
                  "~/Scripts/jquery-ui-1.10.4.min.js"));
  
      bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                  "~/Scripts/jquery.unobtrusive*",
                  "~/Scripts/jquery.validate*"));
  
      bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                  "~/Scripts/modernizr-*"));
  
      bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                    "~/Scripts/bootstrap.js",
                    "~/Scripts/respond.js"));
  
  
      bundles.Add(new StyleBundle("~/Content/themes/ui-lightness/css").Include(
                    "~/Content/themes/ui-lightness/jquery-ui.css",
                    "~/Content/themes/ui-lightness/jquery.ui.core.css",
                    "~/Content/themes/ui-lightness/jquery.ui.resizable.css",
                    "~/Content/themes/ui-lightness/jquery.ui.selectable.css",
                    "~/Content/themes/ui-lightness/jquery.ui.accordion.css",
                    "~/Content/themes/ui-lightness/jquery.ui.autocomplete.css",
                    "~/Content/themes/ui-lightness/jquery.ui.button.css",
                    "~/Content/themes/ui-lightness/jquery.ui.dialog.css",
                    "~/Content/themes/ui-lightness/jquery.ui.slider.css",
                    "~/Content/themes/ui-lightness/jquery.ui.tabs.css",
                    "~/Content/themes/ui-lightness/jquery.ui.datepicker.css",
                    "~/Content/themes/ui-lightness/jquery.ui.progressbar.css",
                    "~/Content/themes/ui-lightness/jquery.ui.theme.css"));
  
      bundles.Add(new StyleBundle("~/Content/css").Include(
                    "~/Content/bootstrap.css",
                    "~/Content/site.css"));
  
      BundleTable.EnableOptimizations = true;
  }
  </code></pre>
  
  <p>And in my _Layout.cshtml </p>
  
  <pre><code>@Styles.Render("~/Content/css")
  @Scripts.Render("~/bundles/jquery")
  @Scripts.Render("~/bundles/jqueryui")
  @Scripts.Render("~/bundles/jqueryval")
  @Styles.Render("~/Content/themes/ui-lightness/css")
  @Scripts.Render("~/bundles/modernizr")
  </code></pre>
  
  <p>Where is my mistake?</p>