Hi,
i wrote a small script to test JQuery UI via Greasemonkey.
Therfore i just add 2 buttons and a click Event:
Copy code
- function test() {
alert("yippie");
}
- jQuery("<div id=\"notex_logged_out\" class=\"demo\"><button>A button element</button><button>Another button element</button></div>")
.css({padding: '10px', background: '#ffc', position: 'fixed',top: '0', left: '0', 'z-index': '66', width: '99%'})
.appendTo('body')
.fadeIn('fast')
.animate({opacity: 1.0}, 1000);
jQuery(function() {
jQuery( "button, input:submit, button", ".demo" ).button();
jQuery( "button", ".demo" ).click(test);
});
This works fine. But sometimes i get an exception when i am loading an arbitrary website:
Copy code
- Error: uncaught exception: TypeError: jQuery("button, input:submit, button", ".demo").button is not a function
After the Error occurs, i have to reload the website one or two times and it works.
Do have to ensure that everything is loaded? If yes, how can i do this?
Or could the problem be something else?
Greetz.