We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3232
    • 380 Posts
    The following error occurred when I moved a site I built from a staging server to production server.

    ManagerManager: An error has occurred: TypeError - $("div.sectionHeader:eq(0)").attr is not a function


    It happens when I go to edit any document. What would cause this and how can I fix it?

    Thanks
    Brian
    modx 0.9.6.2

    The code below is being called into the lower right pane.
    <!-- ManagerManager Plugin :: 0.3.2.1 -->
    <!-- This document is using template: 5 -->
    <!-- You are logged into the following role: 1 -->
    		
    <script type="text/javascript" charset="UTF-8">
    		
    mm_lastTab = "tabGeneral"; 
    mm_sync_field_count = 0;
    synch_field = new Array();
    
    $(document).ready(function() {
    	
    	// Lets handle errors nicely...
    	try {
    						   					
    		// Give IDs to the sections of the form
    		// This assumes they appear in a certain order
    		$("div.sectionHeader:eq(0)").attr("id", "sectionDocSettingsHeader");
    		$("div.sectionHeader:eq(1)").attr("id", "sectionContentHeader");
    		$("div.sectionHeader:eq(2)").attr("id", "sectionTVsHeader");
    		$("div.sectionHeader:eq(3)").attr("id", "sectionAccessHeader");
    		
    		$("div.sectionBody:eq(0)").attr("id", "sectionDocSettingsBody");
    		$("div.sectionBody:eq(1)").attr("id", "sectionContentBody");
    		$("div.sectionBody:eq(2)").attr("id", "sectionTVsBody");
    		$("div.sectionBody:eq(3)").attr("id", "sectionAccessBody");								   
    			// Getting rules from file: /home/content/m/i/n/user/html/assets/plugins/managermanager/mm_rules.inc.php 
    
     // ----------- Rename field -------------- 
    $("textarea[@name=introtext]").parents("td").prev("td").children("span.warning").empty().prepend("Summary");
     // ----------- Change field help -------------- 
    $("input[@name=alias]").siblings("img[@style:contains('cursor:help')]").attr("alt", "The URL that will be used to reach this story. Only numbers, letters and hyphens can be used"); 
    // ---------------- mm_widget_showimagetvs: Add image preview ------------- 
    
    			// Adding preview for section-image
    			$("#tvsection-image").bind( "change load", function() {
    				
    				// Get the new URL
    				$(this).addClass("imageField");
    				var url = $(this).val();
    				url = (url != "" && url.search(/http:\/\//i) == -1) ? ("http://domain.com/" + url) : url;
    				
    					
    				// Remove the old preview
    				$("#section-imagePreviewContainer").remove();
    				
    				if (url != "") {
    					// Create a new preview
    					$("#tvsection-image").parents("td").append("<div class=\"tvimage\" id=\"section-imagePreviewContainer\"><img src=\""+url+"\" style=\""+'max-width:300px; max-height:100px; margin: 4px 0; cursor: pointer;'+"\" id=\"section-imagePreview\"/></div>");	
    					
    					// Attach a browse event to the picture, so it can trigger too
    					$("#section-imagePreview").click( function() {
    														BrowseServer("tvsection-image");		 
    																 });
    				}
    				
    			}).trigger("load"); // Trigger a change event on load
    	
    			
    			
    			// Adding preview for featured-store-image
    			$("#tvfeatured-store-image").bind( "change load", function() {
    				
    				// Get the new URL
    				$(this).addClass("imageField");
    				var url = $(this).val();
    				url = (url != "" && url.search(/http:\/\//i) == -1) ? ("http://domain.com/" + url) : url;
    				
    					
    				// Remove the old preview
    				$("#featured-store-imagePreviewContainer").remove();
    				
    				if (url != "") {
    					// Create a new preview
    					$("#tvfeatured-store-image").parents("td").append("<div class=\"tvimage\" id=\"featured-store-imagePreviewContainer\"><img src=\""+url+"\" style=\""+'max-width:300px; max-height:100px; margin: 4px 0; cursor: pointer;'+"\" id=\"featured-store-imagePreview\"/></div>");	
    					
    					// Attach a browse event to the picture, so it can trigger too
    					$("#featured-store-imagePreview").click( function() {
    														BrowseServer("tvfeatured-store-image");		 
    																 });
    				}
    				
    			}).trigger("load"); // Trigger a change event on load
    	
    			
    			
    			// Adding preview for module1graphic
    			$("#tvmodule1graphic").bind( "change load", function() {
    				
    				// Get the new URL
    				$(this).addClass("imageField");
    				var url = $(this).val();
    				url = (url != "" && url.search(/http:\/\//i) == -1) ? ("http://domain.com/" + url) : url;
    				
    					
    				// Remove the old preview
    				$("#module1graphicPreviewContainer").remove();
    				
    				if (url != "") {
    					// Create a new preview
    					$("#tvmodule1graphic").parents("td").append("<div class=\"tvimage\" id=\"module1graphicPreviewContainer\"><img src=\""+url+"\" style=\""+'max-width:300px; max-height:100px; margin: 4px 0; cursor: pointer;'+"\" id=\"module1graphicPreview\"/></div>");	
    					
    					// Attach a browse event to the picture, so it can trigger too
    					$("#module1graphicPreview").click( function() {
    														BrowseServer("tvmodule1graphic");		 
    																 });
    				}
    				
    			}).trigger("load"); // Trigger a change event on load
    	
    			
    			
    			// Adding preview for module2graphic
    			$("#tvmodule2graphic").bind( "change load", function() {
    				
    				// Get the new URL
    				$(this).addClass("imageField");
    				var url = $(this).val();
    				url = (url != "" && url.search(/http:\/\//i) == -1) ? ("http://domain.com/" + url) : url;
    				
    					
    				// Remove the old preview
    				$("#module2graphicPreviewContainer").remove();
    				
    				if (url != "") {
    					// Create a new preview
    					$("#tvmodule2graphic").parents("td").append("<div class=\"tvimage\" id=\"module2graphicPreviewContainer\"><img src=\""+url+"\" style=\""+'max-width:300px; max-height:100px; margin: 4px 0; cursor: pointer;'+"\" id=\"module2graphicPreview\"/></div>");	
    					
    					// Attach a browse event to the picture, so it can trigger too
    					$("#module2graphicPreview").click( function() {
    														BrowseServer("tvmodule2graphic");		 
    																 });
    				}
    				
    			}).trigger("load"); // Trigger a change event on load
    	
    			
    			
    			// Adding preview for advertiseimage
    			$("#tvadvertiseimage").bind( "change load", function() {
    				
    				// Get the new URL
    				$(this).addClass("imageField");
    				var url = $(this).val();
    				url = (url != "" && url.search(/http:\/\//i) == -1) ? ("http://domain.com/" + url) : url;
    				
    					
    				// Remove the old preview
    				$("#advertiseimagePreviewContainer").remove();
    				
    				if (url != "") {
    					// Create a new preview
    					$("#tvadvertiseimage").parents("td").append("<div class=\"tvimage\" id=\"advertiseimagePreviewContainer\"><img src=\""+url+"\" style=\""+'max-width:300px; max-height:100px; margin: 4px 0; cursor: pointer;'+"\" id=\"advertiseimagePreview\"/></div>");	
    					
    					// Attach a browse event to the picture, so it can trigger too
    					$("#advertiseimagePreview").click( function() {
    														BrowseServer("tvadvertiseimage");		 
    																 });
    				}
    				
    			}).trigger("load"); // Trigger a change event on load
    	
    			
    			
    		
    			// If we have imageTVs on this page, modify the SetUrl function so it triggers a "change" event on the URL field
    			if (typeof(SetUrl) != "undefined") {
    				OriginalSetUrl = SetUrl; // Copy the existing Image browser SetUrl function						
    				SetUrl = function(url, width, height, alt) {	// Redefine it to also tell the preview to update
    					OriginalSetUrl(url, width, height, alt);
    					$(".imageField").trigger("change");
    				}
    			}
    		
    	
    	
    		// Misc tidying up
    		
    		// General tab table container is too narrow for receiving TVs -- make it a bit wider
    		$("div#tabGeneral table").attr("width", "550");
    		
    		// if template variables containers are empty, remove their section
    		if ($("div.tmplvars :input").length == 0) {
    			$("div.tmplvars").hide();	// Still contains an empty table and some dividers
    			$("#sectionTVsHeader").hide(); 
    		}
    	
    	} catch (e) {
    		// If theres an error, fail nicely
    		alert("ManagerManager: An error has occurred: " + e.name + " - " + e.message);	
    		
    	} finally {	
    		
    		// Whatever happens, hide the loading mask
    		$("#loadingmask").hide();
    	}
    });
    </script>
    <!-- ManagerManager Plugin :: End -->
    


    One other thing to mention. This is a godaddy server which is previewing the site with previewdns.com before the site goes live.
    It appears previewdns.com uses some sort of javascript. Could this be conflicting with managermanager? Everything else seems to be working correct.