2014-11-05 19 views
4

我得到未捕獲的TypeError:undefined不是我網站上一頁的函數。該功能在所有其他頁面上無誤地運行。它有點冗長的代碼明智的,所以我只會發布它,如果需要,但這裏是基礎知識。Boostrap Popover錯誤:未捕獲TypeError:undefined不是函數

爲酥料餅的按鈕:

<button class="btn btn-info" id="help" type="button" data-toggle="popover" data-trigger="focus" data-html="true" data-placement="bottom" title="ActiveMLS Documentation" data-content="<small><p><strong>List Custom Property Listings</strong></p></small>"><i class="fa fa-question-circle"></i></button> 

錯誤

Uncaught TypeError: undefined is not a function shell.js:23

從shell.js jquery的行23

/*******************************/ 
/* POPOVER HELPER 
/*******************************/ 
$(document).ready(function(){ 
    $('#help').popover() 
}); 

我很困惑,爲什麼它只在這個頁面上打破?

<!-- blueimp Gallery styles --> 
<link rel="stylesheet" href="/static/uploadlib/css/blueimp-gallery.min.css"> 
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars --> 
<link rel="stylesheet" href="/static/uploadlib/css/jquery.fileupload-ui.css"> 
<div class="row-fluid"> 
    <div class="col-md-12"> 
     <div class="row-fluid"> 
      <div class="section-header text-center"> 
       <button class="btn btn-info" id="help" type="button" data-toggle="popover" data-trigger="focus" data-html="true" data-placement="bottom" title="ActiveMLS Documentation" data-content="<small><p><strong>List Custom Property Listings</strong> - The list Custom Property listings page is an overview of all the Custom Property listings listings and information displayed on the website frontend</p><ul><li><strong>Add Custom Property Listings</strong> - Shortcut to the <em>Add Custom Property Listings</em> page.</li><li><strong>Records Per Page</strong> - Display any list 10, 25, 50, or 100 records at a time.</li><li><strong>Search</strong> - Search any list by keyword(s).</li><li><strong>Listing ID</strong> - The Custom Property ID of the Custom Property listing.</li><li><strong>Address</strong> - The address of the Custom Property listing.</li><li><strong>Edit Custom Property Listing</strong> - Access the <em>Edit Custom Property Listing</em> page for this listing.</li><li><strong>Delete Custom Property Listing</strong> - Access the <em>Delete Custom Property Listing</em> page for this listing.</li></ul></small>"><i class="fa fa-question-circle"></i></button> 
       <!-- TMPL_IF add_mode --> 
       <h1>Add Custom Property Listing</h1> 
       <!-- /TMPL_IF --> 
       <!-- TMPL_IF edit_mode --> 
       <h1>Edit Custom Property Listing</h1> 
       <!-- /TMPL_IF --> 
       <!-- TMPL_IF delete_mode --> 
       <h1>Delete Custom Property Listing</h1> 
       <!-- /TMPL_IF --> 
      </div> 
     </div> 
     <form id="fileupload" method="post" action="<!-- TMPL_VAR request_path -->"> 
      <div class="row-fluid"> 
       <!-- TMPL_IF error_message --> 
        <div class="alert alert-danger alert-dismissable" role="alert" > 
         <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button> 
         Warning!<br /> 
         <!-- TMPL_VAR error_message ESCAPE=0 --> 
        </div> 
       <!-- /TMPL_IF --> 
      </div> 
      <div class="row-fluid"> 
       <fieldset> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Listing Category</label> 
         <!-- TMPL_VAR category ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Listing ID</label> 
         <!-- TMPL_VAR listing_id ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Agent Name</label> 
         <!-- TMPL_VAR l_ag1_id ESCAPE=0 --> 
        </div> 
       </fieldset> 
      </div> 
      <hr /> 
      <div class="row-fluid"> 
       <fieldset> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Price</label> 
         <!-- TMPL_VAR price ESCAPE=0 --> 
        </div> 
        <div class="row-fluid"> 
         <div class="form-group col-md-6"> 
          <label class="col-md-6">Street Address</label> 
          <!-- TMPL_VAR street_no ESCAPE=0 --> <!-- TMPL_VAR street ESCAPE=0 --> 
         </div> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">City</label> 
         <!-- TMPL_VAR city ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">State</label> 
         <!-- TMPL_VAR state ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Zip Code</label> 
         <!-- TMPL_VAR zip ESCAPE=0 --> 
        </div> 
       </fieldset> 
      </div> 
      <hr /> 
      <div class="row-fluid"> 
       <fieldset> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Description</label> 
         <!-- TMPL_VAR remarks_general ESCAPE=0 --> 
        </div> 
       </fieldset> 
      </div> 
      <hr /> 
      <div class="row-fluid"> 
       <fieldset> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Business Type</label> 
         <!-- TMPL_VAR business_type ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">For Lease</label> 
         <!-- TMPL_VAR for_lease_yn ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">For Sale</label> 
         <!-- TMPL_VAR for_sale_yn ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Parcel Type</label> 
         <!-- TMPL_VAR parcel_type ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Area</label> 
         <!-- TMPL_VAR area_desc ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">County</label> 
         <!-- TMPL_VAR county ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">School District</label> 
         <!-- TMPL_VAR schools_d ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Elementary School</label> 
         <!-- TMPL_VAR schools_e ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">High School</label> 
         <!-- TMPL_VAR schools_h ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Year Built</label> 
         <!-- TMPL_VAR year_built ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Type</label> 
         <!-- TMPL_VAR type ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Rooms</label> 
         <!-- TMPL_VAR no_rooms ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Bedrooms</label> 
         <!-- TMPL_VAR bdrms ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Baths, Full</label> 
         <!-- TMPL_VAR baths_full ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Baths, Half</label> 
         <!-- TMPL_VAR baths_part ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Approx. Sq. Ft.</label> 
         <!-- TMPL_VAR sqft ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Approx. Lot Size</label> 
         <!-- TMPL_VAR lot_size ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Approx. Acre</label> 
         <!-- TMPL_VAR acres ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Foundation</label> 
         <!-- TMPL_VAR foundation ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Exterior</label> 
         <!-- TMPL_VAR exterior ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Heating</label> 
         <!-- TMPL_VAR heating ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Cooling</label> 
         <!-- TMPL_VAR cooling ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Fuel</label> 
         <!-- TMPL_VAR heat_fuel ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Parking Spaces</label> 
         <!-- TMPL_VAR gar_prk_no ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Sewer</label> 
         <!-- TMPL_VAR sewer ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Water</label> 
         <!-- TMPL_VAR water ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Fireplace</label> 
         <!-- TMPL_VAR fireplace ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Tax 1</label> 
         <!-- TMPL_VAR tax_1 ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Tax 2</label> 
         <!-- TMPL_VAR tax_2 ESCAPE=0 --> 
        </div> 
        <div class="form-group col-md-6"> 
         <label class="col-md-6">Six Month Tax</label> 
         <!-- TMPL_VAR six_mo_taxes ESCAPE=0 --> 
        </div> 
       </fieldset> 
      </div> 
      <hr /> 
     <!-- TMPL_IF delete_mode --> 
      <p> 
      <!-- TMPL_LOOP Thumbnails --> 
      <img src="/custom_prop/photo_thumbnail?filename=<!-- TMPL_VAR filename -->"> 
      <!-- /TMPL_LOOP --> 
      </p> 
     <!-- TMPL_ELSE --> 
     <!-- Start Upload --> 
     <noscript><p>JavaScript is required for photo upload.</p></noscript> 
     <input type="hidden" name="nonce" value="<!-- TMPL_VAR nonce -->"/> 
      <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload --> 
       <div class="row fileupload-buttonbar"> 
        <div class="col-md-7"> 
         <!-- The fileinput-button span is used to style the file input field as button --> 
         <span class="btn btn-success fileinput-button"> 
          <i class="icon-plus icon-white"></i> 
          <span>Add photos...</span> 
          <input type="file" name="files" multiple> 
         </span> 
         <button type="submit" class="btn btn-primary start"> 
          <i class="icon-upload icon-white"></i> 
          <span>Start upload</span> 
         </button> 
         <button type="reset" class="btn btn-warning cancel"> 
          <i class="icon-ban-circle icon-white"></i> 
          <span>Cancel upload</span> 
         </button> 
         <button type="button" class="btn btn-danger delete"> 
          <i class="icon-trash icon-white"></i> 
          <span>Delete</span> 
         </button> 
         <!-- The loading indicator is shown during file processing --> 
         <span class="fileupload-loading"></span> 
        </div> 
        <!-- The global progress information --> 
        <div class="span5 fileupload-progress fade"> 
         <!-- The global progress bar --> 
         <div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100"> 
          <div class="bar" style="width:0%;"></div> 
         </div> 
         <!-- The extended global progress information --> 
         <div class="progress-extended">&nbsp;</div> 
        </div> 
       </div> 
       <!-- The table listing the files available for upload/download --> 
       <table role="presentation" class="table table-striped"><tbody class="files"></tbody></table> 
       <!-- The blueimp Gallery widget --> 
       <div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls" data-filter=":even"> 
        <div class="slides"></div> 
        <h3 class="title"></h3> 
        <a class="prev">‹</a> 
        <a class="next">›</a> 
        <a class="close">×</a> 
        <a class="play-pause"></a> 
        <ol class="indicator"></ol> 
       </div> 
      <!-- /TMPL_IF --> 
      <div class="row"> 
       <div class="col-md-6"> 
       <!-- TMPL_IF edit_mode --> 
       <input type="submit" name="submit" class="btn btn-primary" value="Save"/> 
       <input type="submit" name="cancel" class="btn" value="Cancel"/> 
       <!-- /TMPL_IF --> 
       <!-- TMPL_IF add_mode --> 
       <input type="submit" name="submit" class="btn btn-primary" value="Save"/> 
       <input type="submit" name="cancel" class="btn" value="Cancel"/> 
       <!-- /TMPL_IF --> 
       <!-- TMPL_IF delete_mode --> 
       <p>Are you sure you want to delete this listing?</p> 
       <input type="submit" name="confirm" class="btn btn-primary" value="Yes"/> 
       <input type="submit" name="cancel" class="btn" value="No"/> 
       <!-- /TMPL_IF --> 
      </div> 
      </div> 
     </form> 
    </div> 
</div> 


<!-- The template to display files available for upload --> 
<script id="template-upload" type="text/x-tmpl"> 
{% for (var i=0, file; file=o.files[i]; i++) { %} 
    <tr class="template-upload fade"> 
     <td> 
      <span class="preview"></span> 
     </td> 
     <td> 
      <p class="name">{%=file.name%}</p> 
      {% if (file.error) { %} 
       <div><span class="label label-important">Error</span> {%=file.error%}</div> 
      {% } %} 
     </td> 
     <td> 
      <p class="size">{%=o.formatFileSize(file.size)%}</p> 
      {% if (!o.files.error) { %} 
       <div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="bar" style="width:0%;"></div></div> 
      {% } %} 
     </td> 
     <td> 
      {% if (!o.files.error && !i && !o.options.autoUpload) { %} 
       <button class="btn btn-primary start"> 
        <i class="icon-upload icon-white"></i> 
        <span>Start</span> 
       </button> 
      {% } %} 
      {% if (!i) { %} 
       <button class="btn btn-warning cancel"> 
        <i class="icon-ban-circle icon-white"></i> 
        <span>Cancel</span> 
       </button> 
      {% } %} 
     </td> 
    </tr> 
{% } %} 
</script> 
<!-- The template to display files available for download --> 
<script id="template-download" type="text/x-tmpl"> 
{% for (var i=0, file; file=o.files[i]; i++) { %} 
    <tr class="template-download fade"> 
     <td> 
      <span class="preview"> 
       {% if (file.thumbnailUrl) { %} 
        <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a> 
       {% } %} 
      </span> 
     </td> 
     <td> 
      <p class="name"> 
       <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a> 
      </p> 
      {% if (file.error) { %} 
       <div><span class="label label-important">Error</span> {%=file.error%}</div> 
      {% } %} 
     </td> 
     <td> 
      <span class="size">{%=o.formatFileSize(file.size)%}</span> 
     </td> 
     <td> 
      <button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}> 
       <i class="icon-trash icon-white"></i> 
       <span>Delete</span> 
      </button> 
     </td> 
    </tr> 
{% } %} 
</script> 
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> 
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included --> 
<script src="/static/uploadlib/js/vendor/jquery.ui.widget.js"></script> 
<!-- The Templates plugin is included to render the upload/download listings --> 
<script src="/static/uploadlib/js/tmpl.min.js"></script> 
<!-- The Load Image plugin is included for the preview images and image resizing functionality --> 
<script src="/static/uploadlib/js/load-image.min.js"></script> 
<!-- blueimp Gallery script --> 
<script src="/static/uploadlib/js/jquery.blueimp-gallery.min.js"></script> 
<!-- The Iframe Transport is required for browsers without support for XHR file uploads --> 
<script src="/static/uploadlib/js/jquery.iframe-transport.js"></script> 
<!-- The basic File Upload plugin --> 
<script src="/static/uploadlib/js/jquery.fileupload.js"></script> 
<!-- The File Upload processing plugin --> 
<script src="/static/uploadlib/js/jquery.fileupload-process.js"></script> 
<!-- The File Upload image preview & resize plugin --> 
<script src="/static/uploadlib/js/jquery.fileupload-image.js"></script> 
<!-- The File Upload validation plugin --> 
<script src="/static/uploadlib/js/jquery.fileupload-validate.js"></script> 
<!-- The File Upload user interface plugin --> 
<script src="/static/uploadlib/js/jquery.fileupload-ui.js"></script> 
<!-- The main application script --> 
<script> 
$(function() { 
    'use strict'; 
    // Initialize the jQuery File Upload widget: 
    $('#fileupload').fileupload({ 
     url: '/custom_prop/file_upload_handler?nonce=<!-- TMPL_VAR nonce -->' 
    }); 
     // Load existing files: 
     $('#fileupload').addClass('fileupload-processing'); 
     $.ajax({ 
      url: $('#fileupload').fileupload('option', 'url'), 
      dataType: 'json', 
      context: $('#fileupload')[0] 
     }).always(function() { 
      $(this).removeClass('fileupload-processing'); 
     }).done(function (result) { 
      $(this).fileupload('option', 'done') 
       .call(this, null, {result: result}); 
     }); 
}); 
</script> 
<!-- End Upload --> 
+0

一定有什麼事情你的頁面上的其他人導致錯誤。恐怕我們需要查看該頁面的其他代碼。 – Sebsemillia 2014-11-05 17:16:20

+0

此頁面是否包含bootstrap.js? – Marcelo 2014-11-05 17:17:51

+0

是的,它包括bootstrap.js – 2014-11-05 17:19:23

回答

1

還有其他的事情要檢查。

如果您在jquery.js之前包括bootstrap.js,也可能導致此問題。 因此請確保您在bootstrap之前包括jQuery

在我的情況下,問題是象下面這樣:

其實我使用的是pre-jQuery Rails,所以當我包括Bootstrap JS文件,我沒有想到的是,包括與他們捆綁的版本jQuery會導致任何問題,但是當我刪除一個JS文件時,一切都開始完美。

Also one more possible case is, there could be multiple instances of jQuery in the page. So search for a duplicate version of jQuery and remove them if there is any.

這裏有一個很好的鏈接來看看。

Avoiding Conflicts with Other Libraries

+0

你的答案沒有幫助,但你提供的鏈接,+1 – Melvin 2015-08-13 13:15:01

相關問題