[support] JS in Drupal 7

Fred Jones fredthejonester at gmail.com
Thu Oct 3 16:53:38 UTC 2013


Answer is I failed to use "behaviors" and the answer is here:
http://drupal.stackexchange.com/a/525

Thanks

On Thu, Oct 3, 2013 at 7:27 PM, Fred Jones <fredthejonester at gmail.com> wrote:
> 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