This is how jQuery is included in d7
(function ($) {
// jquey codes here
})(jQuery);
How i can include javascript code (not jquery) in d7?
This is how jQuery is included in d7
How i can include javascript code (not jquery) in d7? |
||||
|
If you want to write a plain JavaScript instead of JQuery, You can proceed with normal function declaration like
and go ahead. It is normal way of the doing things in javascript, More over jQuery is a framework of javascript and as said you can add js files in the traditional way
|
|||
|
jQuery is just a JavaScript library, so you can include plain JS inside the jQuery wrapper and it'll work fine. All the wrapper does is allow you to use the See the following example - standard JS inside a Drupal behaviour.
The Managing JavaScript in Drupal handbook page has LOADS of useful information about JavaScript in Drupal, it's definitely worth a read. |
|||
|
This is how jQuery is included so you can use the $ symbol. But you can write any piece of js code in that file without this part:
But to include files, you can simply use |
||||
|