x-editable: Cannot read property 'defaults' of undefined - poshytips

Latest version. Using inline. Loading only CSS and JS. Error:

Uncaught TypeError: Cannot read property 'defaults' of undefined 
jquery-editable-poshytip.js:4642
(function ($) {
    "use strict";

    //extend methods
    $.extend($.fn.editableContainer.Popup.prototype, {
        containerName: 'poshytip',
        innerCss: 'div.tip-inner',
        defaults: $.fn.poshytip.defaults,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

About this issue

  • Original URL
  • State: open
  • Created 13 years ago
  • Reactions: 1
  • Comments: 15

Most upvoted comments

If you use the CDN, you can declare <script>$.fn.poshytip={defaults:null}</script> just before calling the jquery-editable-poshytip.js file.

defaults: ($.fn.poshytip) ? $.fn.poshytip.defaults : null,

Turns out I was referencing x-editable incorrectly facepalm Thank you for the assistance, @Aymkdn ! For my MVC brothers and sisters out there, In the shared layout header:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/css/bootstrap-editable.css" rel="stylesheet" />
<script type="text/javascript">
    $('head').append('<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.1/jquery-editable/css/jquery-editable.css" rel="stylesheet" />');
    $.fn.poshytip={defaults:null};
</script>

And in my script (just to be safe)

function editDescription(ticketId)
{
    $.fn.poshytip = { defaults: null };
    jQuery.getScript("//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/js/bootstrap-editable.min.js", function () { useEditableYo(ticketId) });
}