Drupal 7 Js Code

JavaScript files can be added to a module and/or theme .info files. When adding JavaScript using this method, it will be included on every page. This allows Javascript to be aggregated in an optimal way, and is the preferred method of adding Javascript that most visitors will need on most/all pages on a typical site visit.

(function($) {
function custom_module_function(context) {
$(document).ready(function() {
/* your code start here */

/* your code end here */
});
}

Drupal.behaviors.custommodule = {
attach: function(context) {
custom_module_function(context);
}
}
})(jQuery);

Was this article helpful?

Related Articles