[support] JS in Drupal 7

Fred Jones fredthejonester at gmail.com
Thu Oct 3 16:27:07 UTC 2013


I added a JS file to my theme in a D7 site and then put code like this:

(function ($) {
console.log(1);
  jQuery('#edit-views-send-from-name').val('');
console.log(2);
}(jQuery));

and in Firebug I see the 1 and 2 but the middle line doesn't run. But
if I copy and paste that code into the box on the right of Firebug's
Console and "Run" it, then it does work, so the code is correct.

There are a bunch of other lines between 1 and 2 that I left out for
this post, but they all work when I run it manually and the values
being set (and items being hidden) are not set (or shown) by other JS
on the page--the value is in the HTML, so it's not as though my JS is
competing with some other JS to set these values.

Any ideas why my code isn't working?

Thanks.


More information about the support mailing list