a simple question on jquery closure

Wrapping a function between parenthesis ensures this function to be evaluated as a function expression. That happens because the Grouping Operator (the parentheses), can only evaluate expressions. If no parenthesis are used, it will be interpreted as a function declaration, and it will cause a syntax error, since the function name is not optional for … Read more

jQuery and MooTools Conflict

When you have jQuery specific code that is using $, the simplest way is to wrap the code with the following: // Disable the $ global alias completely jQuery.noConflict(); // For jQuery scripts (function($){ // set a local $ variable only available in this block as an alias to jQuery … here is your jQuery … Read more

Cross domain iframe issue

If you don’t have control over the framed site, you cannot circumvent the cross-domain policy. If you have control over both sites, you can use the postMessage method to transfer data across different domains. A very basic example: // framed.htm: window.onmessage = function(event) { event.source.postMessage(document.body.innerHTML, event.origin); }; // Main page: window.onmessage = function(event) { alert(event.data); … Read more