Friday, December 4, 2015

Javascript access functions and variables inside Jquery

(function($) {
$.fn.mainFunction = new function (){
var testVal = "Test";
this.test = function(){
console.log('inside test');
}
}
}(jQuery));

Now you can access testVal and mainFunction.test()

No comments:

Post a Comment

CSS tricks

Mixed paint in background: background: linear-gradient(to right, #b6e358, #38b143) Grid view: display: grid; grid-template-columns: a...