multiple behaviors in a single .js file failing

Events happening in the community are now at Drupal community events on www.drupal.org.
firebus's picture

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,

Garrett Albright's picture

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

firebus's picture

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: