multiple behaviors in a single .js file failing

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by firebus on March 1, 2011 at 7:13pm

Howdy.

I have a small helper module in D6 with a .js file that adds a function to Drupal.behaviors.

I've found that if I try to add a second behavior function, neither behavior is triggered.

so:

Drupal.behaviors.first = function (context) {
alert('first');
}

works and shows an alert on page load. but:

Drupal.behaviors.first = function (context) {
alert('first');
}
Drupal.behaviors.second = function (context) {
alert('second');
}

fails, and I see no alerts on page load. is this expected behavior and/or is it documented anywhere?

thanks!

Comments

Are you using Firebug? If so,

Posted by Garrett Albright on March 1, 2011 at 9:08pm

Are you using Firebug? If so, can you see where the error is happening - on the execution of the behaviors functions, or on the assignment of them?

i'm not seeing any errors

Posted by firebus on March 8, 2011 at 5:43am

thanks for your response garrett!

yes, i have firebug installed.

iirc i wasn't getting any javascript errors.

however, now i am unable to reproduce the issue, so probably i was doing something dumb in my test case :(

Javascript

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /