You are here

Javascript

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

Using the jquery library thickbox to have lightboxes

Wiki Terms: 

After opening a lightbox with thickbox: see http://jquery.com/demo/thickbox/

You can close the lightbox and have an href link open a url in the parent window:


Register for an Infinite Connection account.

Also to have a form and click submit but close the lightbox and have the form submit to the parent page use this code.


<?php
$output .= "
?>

this took me an hour or two to figure out, so you're welcome :)

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer