Reputation: 13172
My javascript code like this :
;(function($){
$.ag.hideScrollbar = function (currentWidth) {
...
};
// not executed
//start
$.ag.initMap = function(mapCanvas){
...
};
$.ag.initMapAutocomplete = function () {
...
};
//end
}(jQuery));
I want map script not executed
I do not want to comment the script. I want to add a condition for the script not to run
How can I do it?
Upvotes: 0
Views: 40
Reputation: 60563
you can add an if
statement to that function
something like :
;(function($) {
if (element.length > 0) { //or whatever condition you need to test
$.ag.hideScrollbar = function(currentWidth) {
...
};
}
// not executed
//start
$.ag.initMap = function(mapCanvas) {
...
};
$.ag.initMapAutocomplete = function() {
...
};
//end
}(jQuery))
Upvotes: 1