Conflict Between 2 Javascript
how can I solve a conflict between 2 javascript one of them works but not the second one but when I separate them they work great. the conflict only happens when they are in the sa
Solution 1:
Refer this code and Link
<bodyonload="func1(); func2();">
Solution 2:
/*
⚐ A Revealing Module Pattern (Public & Private) w Public Namespace 'myscript' like below avoids collisions with other scripts.
myScript.color --> red
myScript.hello('Jane') --> Hello Jane
*/var myScript = (function() {
// reference document only once for performancevar doc = document;
// object to expose as public properties and methods such as clock.nowvar pub = {};
//myscript.color
pub.color = 'red';
//myscript.hello
pub.hello = function (name) {
alert('Hello ' + name);
};
//APIreturn pub;
}());
Post a Comment for "Conflict Between 2 Javascript"