This is by far the most annoying and bizarre issue I have ever encountered with jQuery. It is ridiculously basic (one of those Murphy’s Law bugs)
I have a div (divDialog):
<div id="divDialog">
</div>
I call the dialog function:
$('#divDialog').dialog();
It gives me this error in firebug:
this.element[0].nodetitle is undefined
If I remove the div, the error disappears. If I console out just the selector portion,
it shows the node in firebug and all looks well. 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 am also extending the Array prototype:
Array.prototype.isArray = true; //this allows us to say if(variable.isArray) to detect arrays
Any ideas? I am beyond frustrated with this. Any help or direction would be much appreciated.
The problem was apparently a version issue with jQuery, jQuery UI, or the pairing of them. I was using jQuery 1.7.1 and jQuery UI 1.8.1. The problem disappeared upon using that AJAX libs from google. Nodetitle only occurs within the UI lib, so I am assuming the big lies somewhere in there. To any jQuery devs, I would suggest some sort of package control between UI and vanilla. Perhaps UI could be ported into the browser by using an AJAX call so that UI always matches up with the proper vanilla package? Anyway, resolved.