JQuery Dialog Bizarre Error

This is the most annoying and bizarre issue I've ever encountered with jQuery. It's ridiculously basic (one of those Murphy Law bugs)

I have a div (divDialog):

<div id="divDialog"> </div> 

I call the dialog function:

  $('#divDialog').dialog(); 

This gives me this error in firebug:

  this.element[0].nodetitle is undefined 

If I remove the div, the error will disappear. If I console only part of the selector, it shows the node in firebug and everything looks good. I am currently extending jquery in the following ways:

 $.fn.isAfter = function(sel){ //returns true if element is after, else return false, for animations return this.prevAll(sel).length > 0; } $.fn.isBefore= function(sel){ //returns true if element is before, else return false, for animations return this.nextAll(sel).length > 0; } $.fn.exists = function(){ //returns true if element exists, false if not return this.length>0; } $.fn.btnClick = function(fn){ //check if the element is disabled before executing onclick $(this).click(function(){ if($(this).attr('disabled')!='disabled'){ fn(this); } }); return $(this); } $.fn.btnToggle = function(){ //toggle disable/enable if($(this).attr('disabled')=='disabled'){ $(this).removeAttr('disabled'); } else{ $(this).attr('disabled','disabled'); } return $(this); } 

I also extend the prototype of the array:

  Array.prototype.isArray = true; //this allows us to say if(variable.isArray) to detect arrays 

Any ideas? It upsets me. Any help or guidance would be greatly appreciated.

+4
source share
1 answer

The issue was apparently a version issue with jQuery, jQuery UI or pairing them. I used jQuery 1.7.1 and jQuery UI 1.8.1. The problem disappeared when using these AJAX libraries from Google. Nodetitle only appears in the UI lib, so I assume that there is a big lie. For any jQuery developers, I would suggest some package management package between the UI and vanilla. Perhaps the user interface can be ported to the browser using an AJAX call so that the user interface always matches the corresponding vanilla package? Anyway, allowed.

+1
source

Source: https://habr.com/ru/post/1440138/


All Articles