diff --git a/src/NuGetGallery/Scripts/nugetgallery.js b/src/NuGetGallery/Scripts/nugetgallery.js
index de26b1d72a..1ea9f74698 100644
--- a/src/NuGetGallery/Scripts/nugetgallery.js
+++ b/src/NuGetGallery/Scripts/nugetgallery.js
@@ -2,6 +2,11 @@
///
(function (window, $, undefined) {
function attachSearchBoxBehavior($input, $menu) {
+ if ($input.length == 0 || $menu.length == 0) {
+ // If we were given nothing, just return.
+ return;
+ }
+
// Remember the previous state in order to perform smooth animation transforms
var prevstate = false;
function popit(assumeFocused) {
@@ -72,7 +77,7 @@
// Get the service status
checkServiceStatus();
- attachSearchBoxBehavior($('#searchBoxInput'), $('#menu'));
+ attachSearchBoxBehavior($('#searchBoxInput.expanding-search'), $('#menu.expanding-search'));
});
// Add validator that ensures provided value is NOT equal to a specified value.
diff --git a/src/NuGetGallery/Views/Shared/Layout.cshtml b/src/NuGetGallery/Views/Shared/Layout.cshtml
index 361d77108c..c5d5456a4f 100644
--- a/src/NuGetGallery/Views/Shared/Layout.cshtml
+++ b/src/NuGetGallery/Views/Shared/Layout.cshtml
@@ -21,7 +21,7 @@
@Html.Partial(MVC.Shared.Views.UserDisplay)