Questions tagged [javascript]

Use it for questions about JavaScript code that is very specific for Drupal.

Filter by
Sorted by
Tagged with
0
votes
1answer
630 views

jcarousel not working on block?

1) Place this module directory in your modules folder (this will usually be "sites/all/modules/"). 2) Enable the module within your Drupal site at Administer -> Site Building -> Modules (admin/...
1
vote
1answer
1k views

jQuery dialog is duplicated when set on a form that uses AJAX

Im using jQuery dialog on my form. Drupal.behaviors.custom = { attach: function (context, settings) { $('.form-container').once('form-cont', function () { Drupal.custom.modalLinks(); })...
0
votes
1answer
2k views

Node Gallery Lightbox

I am using Node Gallery Module, just want to know if there is a way we can open the images in Lightbox or Colorbox? I know this can be done in Media Gallery module but can not find any way in Node ...
7
votes
2answers
460 views

Big pipe and behaviors context

I have problem with drupal behaviors and context in combination with big pipe. It seems like context variable sometimes contains same part of page. I have tried: (function ($, Drupal) { Drupal....
1
vote
1answer
892 views

How to dynamic change the size of the icon marker when using Leaflet maps and views

I am using the module Leaflet and its sub-module "Leaflet views" and IP Geolocation Views & Maps (IPGV&M for short), which provides a nice way to assign icon images to, in my case, content ...
-1
votes
1answer
218 views

How align the image and content in same in this views slidehow [closed]

This is a slide show generated by Views Slide module in Drupal 8. Can any one tell me how to put the image and content in same line? Below is the markup generated by the view config. <div id="...
0
votes
1answer
693 views

What is the best way to add a confirmation tooltip to the remove button of a managed_file field?

Another Update I'm trying to implement the solution found here: Intercept click event on a button, ask for confirmation, then proceed, but the remove button still submits normally. I know my JS is ...
4
votes
2answers
3k views

Using Media, views, and colorbox to create a image gallery

Currently I am running in D7 with the following modules: Media 7.x-2.0 Views 7.x-3.7 Colorbox 7.x-2.4 I am trying to create an image gallery using these modules with the following steps. Please ...
0
votes
0answers
44 views

javascript code does not execute for authenticated users

Maybe someone of you has already encountered this weird problem that I am having. I have javascript code that runs fine when you are an anonymous user and no longer works when authenticating. The ...
0
votes
2answers
275 views

AJAX SettingsCommand Usage

Class Documentation: SettingsCommand I'm trying to figure out how to use this Ajax Command correctly. I must be confused from the documentation, so I'm hoping someone can shed some light where I'm ...
0
votes
0answers
11 views

Add custom param data-cmp-src in drupal_add_js [duplicate]

I added js files in the header of my drupal 7 site by using drupal_add_js as the example below: drupal_add_js(drupal_get_path('theme', 'ims') .'/js/qc2.js', array('group' => JS_THEME, 'scope' => ...
1
vote
1answer
41 views

How to get the parameter value from an ajax call in the page controller?

I have the following js code according to es6. (($, Drupal) => { Drupal.behaviors.mymodule = { attach: () => { document.querySelectorAll("a").forEach(element => { ...
2
votes
1answer
716 views

Gmap cluster different marker types seperatly

I created a Gmap with the Gmap module and views. There are two different marker types, based on different Gmap marker fields in the used node types. The markers are clustered with GMaps Utility ...
0
votes
1answer
35 views

How to force a JS library to be loaded via HTTPS?

How can I force a js library to always load only via SSL? Specifically, I want to get Drupal to always load stripe.js with SSL, because stripe.js refuses to load over http (you get a 403 FORBIDDEN ...
0
votes
1answer
824 views

Cookies for anonymous users aren't read nor checked

I currently have a module on http://hitechwolf.com that creates a welcome overlay upon a user's first visit, This should work by utilizing a jquery created cookie and showing the overlay based on its ...
0
votes
3answers
3k views

Show node field as a carousel using jCarousel module programmatically?

I have a content type with a fiel called: fotos-carousel (image type) which I want to show as a carousel. I can't use views to do this. I installed the jcarousel module and read the documentation to ...
1
vote
1answer
1k views

How do I display, in a ColorBox popup, a caption AND a title (caption from image 'alt' attribute and title from 'title' attribute

I am trying to display in a ColorBox popup, a caption AND a title (caption from image 'alt' attribute and title from image 'title' attribute). The colorbox is opened when an image is clicked. Here ...
0
votes
1answer
19 views

JS scripts not loading on certain pages

When logged in as a user (not admin), some JS scripts do not load on certain pages. I found out about this issue because I am using the module EU Cookie Compliance and the scripts it uses (...
1
vote
3answers
1k views

How to dynamically pass a user field value to jQuery?

I have a notification bar with a counter, it actually prints the user's "notifications" field value (if it's greater than 0): <div id=container> <a href="#" class="activity_link">Activity&...
0
votes
4answers
2k views

How to run jquery codes before and after ajax call?

I want to create a loading code while the ajax call is not yet complete, AND enable my jquery code after calling the ajax of drupal form. The ajax I'm referring to is the "Add new field/Add more" of ...
0
votes
2answers
31 views

How can I get Slick Slider to display the images?

I have a "test" content type with a title, body, and a media entity field that allows for multiple images. I installed Slick Slider 2.2. I mostly followed the steps outlined here: https://...
0
votes
1answer
2k views

Multiple checkboxes in an AJAX calls

I've been developing this phonegap app and I'm stuck with a few things and one of them is multiple checkboxes - I hope you can help. I've got the below code HTML <input type="date" id="date" /&...
1
vote
2answers
3k views

Uncaught TypeError: Cannot set property 'bootstrap' of undefined

I'm receiving the following two errors, i'm unsure how to fix them. after doing some research this file has had issues before. The solutions did not solve my problem. Could this be a simple script ...
-1
votes
0answers
45 views

How do I use Drupal.settings.views?

I am working in ajax where I submit request and getting response from view but my pagination seems not working. This is the JavaScript code. function abc(arguments){ console.log(...
0
votes
1answer
510 views

Using 'return' with an ajax callback renders an entire page before my content is loaded

I'm developing a module that uses Openlayers maps and Drupal Commerce. When you click on the map, you should see products that relate to those coordinates of where you click. I have this working ...
1
vote
2answers
5k views

CKEditor placeholder text doesn't work (config.js)

I'm trying to add placeholder text to my ckeditor screen like for example Type here ... . You can do this with the configuration helper plugin. I've placed the ckeditor library in sites/all/libries. ...
0
votes
0answers
21 views

bootstrap_barrio subtheme breaks ckeditor's media insert in custom block in node layout builder

I'm facing this problem (seems to be producible) in a contrib theme that breaks the ckeditor media insert button on custom blocks in the layout builder of individual nodes... The javascript error says ...
1
vote
1answer
726 views

JS not work in bootstrap subtheme

I am using bootstrap 3.6 sub-theme/cdn, I've added scripts[] = js/custom.js and I can see it in the source code of the page. But... javascript is not working. I copied some javascript code modules ...
0
votes
0answers
7 views

View: update single rows with AJAX on a VBO view?

We use a view to list all new entities, let's say "message entities". Users can create messages, those messages are created as a custom entity type and get listed in an inbox as long they ...
-1
votes
0answers
21 views

Steps to embed HTML5/canvas animation

I have a test animation (HTML5 + JS), given me by a designer. I'm trying to embed it in our Drupal site (8.9.1) to make sure it's doable. I'm not sure how though. Maybe I'm just missing a step, or ...
2
votes
2answers
1k views

How to validate file is selected or not on ajax processed jquery validation

I am trying to do jquery validation on file upload for file is select or not. I want when user click on upload before submit check file is selected or not. if not stop ajax request. Any Idea to ...
1
vote
2answers
2k views

add link in Colorbox caption

In my gallery, what i write as image title is the caption of my image and that is great. Now I would like to add a link (external url) to my caption, how can i do that? I already try to write normal ...
2
votes
1answer
366 views

How do I add onclick Google Analtyics custom event “add to cart” to add to cart button in Drupal Commerce?

I want to fire a Google Analytics custom event called "add to cart" when someone adds a product to the cart. I am using classic Google Analytics, not Universal. I tried adding this to the ...
0
votes
1answer
1k views

How to add jQuery Datepicker option which accepts a function as an argument

I have added a date_popup field to a form : $form['arrival_date'] = [ '#type' => 'date_popup', '#title' => t('Arrival date'), '#date_format' => 'd/...
1
vote
1answer
3k views

How to use an external jQuery plugin with Drupal's no-conflict jQuery

I'm using drupal_add_js() to load some external js: drupal_add_js('http://jquery-accordion.googlecode.com/svn/trunk/jquery.accordion.js', 'external'); This produces 'TypeError: $ is not a function' ...
3
votes
1answer
1k views

“Uncaught TypeError: Cannot call method 'call' of undefined at 507 jquery.validate.js”

I am trying to implement clientside validation using the clientside validation model. I have been following the documentation located here. Specifically the Form API Section for Drupal 7. I believe I ...
0
votes
3answers
345 views

How can I use drupal_add_js() to include the following script?

How can I use drupal_add_js() to include the following script? <script src="http://example.net/script.js" data-config="{'skin':'skins/black/skin.css','volume':50,'autoplay':true,'shuffle':true,'...
0
votes
1answer
756 views

Sending webpage through email

I've implemented hook_menu and in page callback there is a function in my module which retrieves some records randomly and theme them with theme_table. Now I want a button on the page for sending this ...
4
votes
2answers
1k views

Adding new rows on a draggable table via jquery

I have a draggable table with preloaded "new items" - sorta like the Power Edit feature of the menu_editor module. Everything works perfect. However, I want to have a button that adds a new row via ...
0
votes
1answer
885 views

Using #states to disable a field collection field

I am trying to disable a date field's second value, inside a field collection, but it isn't working. My hook_form_alter has this: $form['field_certification']['und'][0]['field_validity']['und'][0][...
2
votes
2answers
355 views

Equivalent method or “body onload”

First, I have tried for several hours to weed through the various search results of the keywords above. I've found several things that seem to answer this but they're for D7, one of them from 2012 ...
2
votes
1answer
49 views

How I can alter reCAPTCHA script tag in html_head

The reCaptcha module adds a Javascript with hook_captcha(). I want to add another attribute "type" to this script tag. I can't find a hook to achieve this. Here is the code from the ...
5
votes
1answer
999 views

How to add multiple products to cart at the same time with attributes

I have different view blocks that display multiple products on the same page, each product has their own attributes such as product bundle and custom line item, these serves as an option set / ...
0
votes
2answers
1k views

Display images of a specific content type in a lightbox when vocabulary is clicked

Background I am using Drupal 7 and I have a taxonomy "Kitchen Type" and content type "Kitchen Picture" having default field_image for images. There are three Kitchen Types Traditional, Contemporary ...
1
vote
1answer
4k views

How to display google map field in hidden div?

I have a Google Map Field in my form. I'm editing the theme of the form and I'm using a jquery but the map is broken. The map is inside a div and the code of the template is this: And here is the ...
2
votes
2answers
1k views

Trigger jQuery “add more” multiple times

I have a form that I am filling with default values in hook_form_alter. Some of the fields are in a in a field group and I need to trigger the "add more" button using code. I figured out how to send ...
0
votes
2answers
418 views

How to make get for drupal behaviors to run only once?

Drupal.behaviors.js_mod = { attach: function (context, settings) { //$('body', context).append(chart); // $( '#drupal-myradar', context ).once $.get( "/web/js/mod", function( data ) { ...
3
votes
3answers
1k views

Views UI doesn't provide links to expand fieldsets anymore

I have moved an entire drupal site to another server. While everything else seems to work fine, I can't quite access collapsed fieldsets in Views UI anymore. It looks like this All fieldsets (STYLE ...
0
votes
0answers
21 views

How to use JavaScript code in the confirmation message?

I need to add JavaScript for a 3rd party service to the confirmation pages of multiple webforms (Drupal 8, Webform 5); staff need to be able to easily manage this so I can't hardcode a single item, ...
1
vote
1answer
2k views

Display Auto Generated Youtube Thumbnails with 'Video Embed Field' Module in Views

I added some videos to my site and I'm using views to display them. I followed a tutorial and i used the rewrite the output option of the view with allowed replacement patterns to display videos in ...

1
2 3 4 5
62