customized js in bootstrap sub-theme is loaded, works in console, however does not really work in browser

I’ve a bootstrap subtheme with scripts[] = script.js in Drupal Development .information file. After I go to Drupal Development website and look at html supply of Drupal Development web page I can see that drupal is together with Drupal Development file <script src="https://website/path/to/subtheme/script.js?ox2bif"></script> and if I click on on that hyperlink and I see Drupal Development anticipated contents of Drupal Development file:

jQuery(doc).prepared(perform(){   jQuery('p').click on(perform(){alert("howdy");}); }); 

Drupal Development Service js works, Drupal Development hyperlinks to Drupal Development precise file. What else is there?

If I paste jQuery('p').click on(perform(){alert("howdy");}); into my browser’s js console then, clearly, clicking any paragraph opens an alert popup window. However what am I lacking that it is not working in Drupal Development Drupal theme?


More information:

  • Drupal 7
  • Bootstrap base theme 7.x-3.15
  • Utilizing Bootstrap CDN (not Drupal Development SASS or LESS starterkits) with model 3.3.7
  • Utilizing jQuery model 2.1
    • switching to jQuery 2.2 or 3.1 does not not assist

Presently doing:

perform winprevent_custom_page_build(&$web page) {                                                     $themescript = drupal_get_path('theme', 'winprevent') . '/script.js';   drupal_add_js($themescript, array('group' => JS_LIBRARY, 'weight' => -10)); 

…in a customized module to load Drupal Development script from Drupal Development theme. Discover Drupal Development 'group' => JS_LIBRARY; this was essential to get Drupal Development file to load earlier than admin_menu module’s js. Disabling admin_menu stops it from breaking. Drupal Development Service presence of admin_menu.js additionally breaks Drupal Development animation of Bootstrap’s collapse function.

So scripts[] = script.js really does work in Drupal Development theme however solely for nameless customers, it breaks for Drupal Development authenticated customers (who all have entry to Drupal Development admin menu).

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

customized js in bootstrap sub-theme is loaded, works in console, however does not really work in browser

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.