Quantcast
Viewing all articles
Browse latest Browse all 8

Writing regular old JQuery the regular way in Drupal 7

Wiki Terms: 

This doesn't use the Drupal behaviors or attach detach stuff, just plain old jquery straight up:

(function($) {
   $().ready(function() {
     alert('hello');
   });
   $('#submit').live('click', function(){
	      alert('ack!');
	    });
})(jQuery);

this works and says hello to you on page load, and upon clicking a submit button wrapped in a div with an id of #submit:
it says 'ack!' to you

Note you only need to wrap your javascript one time with the


Viewing all articles
Browse latest Browse all 8

Trending Articles