开发者

Haacked JQuery Undoable "Object doesn't support this property"

I refer to Phil Haack's "Undoable" article found here: http://haacked.com/archive/2010/01/01/jquery-undoable-plugin.aspx

I've copied the exact ma开发者_开发技巧rk-up for the table from the tables demo page, included JQuery 1.3.2 min, and copied the exact script block used on the demo page but when it gets to this bit:

$('a.delete').undoable({
 inlineStyling: false,
 showingStatus: function(undoable) {

I keep getting "Object doesn't support this property or method". Is there anything obvious that I might be missing to cause that? I'm just using IE8 on the dev machine but that shouldn't be a problem (I hope).


try this version (and look through the code for similar un-apostrophed JSONs).

$('a.delete').undoable({
 'inlineStyling': false,
 'showingStatus': function(undoable) {


"Object doesn't support this property or method" may imply that your link to the jQuery library is invalid. Can you verify that jquery is actually being loaded maybe with a simple alert like this:

 $(document).ready(function(){alert("loaded")});


Are you perhaps loading the javascript files from the file system? This could fail in Internet Explorer due to security restrictions. From what you are saying it could be that you are loading jquery fine, but not the plug-in. Try to load both files from the site, as another commenter suggested.

There is no problem with the plug-in. I've tested it both in Firefox and IE 7 and it works. So the problem is of the javascript libraries failing to load for some reason.


Along the lines of Vincent's response - make sure you're adding jquery.undoable.js file to your page


Make sure you include your own .js script AFTER you include the JQuery library script


Perhaps the '$' symbol isn't bound to the jQuery object. Does replacing '$' with 'jQuery' work?


try

$('a.delete').ready(function() { this.undoable({
 inlineStyling: false,
 showingStatus: function(undoable) {
}}

also, the sample code actually looks like this, did you try just this code? (He said it does not have a backend in the sample...

<script type="text/javascript" src="lib/jquery-1.3.2.min.js"></script> 
<script type="text/javascript" src="src/jquery.undoable.js"></script> 

<script type="text/javascript"> 
    /* 
        Enables undoable operations
    */
    $(function() {
        $('a.delete').undoable();
    });
</script> 


The actual code defining undoable is not in the example on the page, and not part of jQuery. I think you forgot to include the library itself.

You can get that here: http://github.com/Haacked/jquery.undoable/blob/master/src/jquery.undoable.js

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜