JavaScript is a prototype-based object-oriented scripting language that is dynamic, weakly typed and has first-class functions.

learn more… | top users | synonyms (1)

0
votes
1answer
10 views

CKEditor Toolbar Configuration

I would like to use CKEditor on my Drupal website. But the toolbar is not showing up when I go to edit appearance on any profile (full or advanced). Although, when I add or edit any type of content, ...
0
votes
1answer
17 views

Access Functions Attach in Drupal Behaviors From Global Scope

I have this Drupal Behaviors Javascript code: Drupal.behaviors.myid_templates = { attach: function(context, settings){ function local_function(){ alert('local_function'); ...
1
vote
4answers
204 views

Adding JavaScript just to one node

I have added scripts[] = js/add_property.js to my .info file which works perfectly. That loads the JavaScript for every page though, so how do you do it so that it only loads for the .tpl that it is ...
0
votes
0answers
21 views

Detect Keypress Event in TinyMCE Text Area in Drupal 7 Form API

I already successfully embedded a TinyMCE text editor in a text area in Drupal 7 Form API. See code below: $form['text-modal'] = array( '#type' => 'text_format', '#format' => ...
1
vote
0answers
32 views

jQuery plugin isn't reacting in Drupal site [closed]

On this page i try to implement PrettyPhoto jQuery lightbox plugin for my Bootstrap 2 website. However the images are not appearing in the lightbox? It looks like the jQuery plugin isn't reacting? ...
0
votes
1answer
14 views

copy content-profile elements to another page

In my content profile page, I have a set of three elements: a search field, a set of checkboxes with data, a text area that shows the chosen options. I also have a number of onclick and keyup ...
0
votes
1answer
22 views

TinyMCE textarea not editable

I have integrated tinymce in my form, inside a modal. $form['myid_templates_editor']['text-modal'] = array( '#type' => 'text_format', '#format' => 'full_html', '#prefix' ...
1
vote
1answer
13 views

Panels settings modal not working

I am trying to make changes to a saved "selection rule" on one of my Panels, but when I click the settings gear icon, the icon moves on top of the "Delete" icon for a second, then moves back alongside ...
0
votes
1answer
23 views

Custom Javascript doesnt work unless JQuery is set to Default jQuery Version

I spent the entire day trying to figure out why my custom JavaScript was not working. Eventually I stumbled into the JQuery Update configuration and set it so that the JQuery that I use for my site ...
0
votes
0answers
13 views

Display a function's return value through AJAX response

I have this jquery ajax request below: jQuery.ajax({ type: 'POST', url: '?q=myid_query_db', data:{ 'db_server': 'postgres', }, }).done(function(o){ ...
1
vote
1answer
25 views

Override module javascript file in theme or custom module

Is it possible to override a single javascript file from a module within a theme or custom module? My specific use would be for Views/js/ajax_view.js - I've had to apply multiple patches to get ajax ...
0
votes
0answers
37 views

Render Swagger UI output in Drupal?

Is it possible to render Swagger UI output in Drupal? I'd like something similar to this example in the content area of a page: http://petstore.swagger.io/ I've tried two "in progress" modules ...
0
votes
1answer
16 views

Field with '#type' = 'hidden' in hook form alter doesn't show #id in the source and it's not possible to show it with jQuery

I put in my template.php an hook_form_alter function where I assign '#type'= 'hidden' to "field_bergamo". But I want to show it when in the select list "Provincia" of the same form I select the ...
1
vote
0answers
15 views

jQuery for Drupal 7 Views Search Highlighting

I'm trying to add highlighting to my Drupal 7 Views-based search interface, so that when a user search for a word, words, or phrase, whatever they searched for is highlighted in the search results. I ...
0
votes
1answer
23 views

The correct way to include jquery in a module's form

I'm trying to use jquery in a form of mine that is rendered via the form api. How i'm getting jquery to work now is like so $form['raf_raffle_name'] = array( '#type' => "textfield", ...
0
votes
1answer
27 views

JS script in theme is ignored for anonymous users

It just discovered that my script.js in my theme is ignored for anonymous users. But only on certain pages. When logged in everything works on all pages. When logged out things only work in some ...
0
votes
0answers
21 views

how to add “remove” button in widgets items of entity reference view widget field?

i have a problem, i want to add a button "remove" for each items, this is the code of the module : /** * Implements hook_form_BASE_FORM_ID_alter(). */ function ...
-1
votes
0answers
14 views

jQuery only works on tablet and smartphone if I refresh

I have a jQuery script, which works perfect on desktop, but on tablets and smartphones it only works if I refresh the page or change the orientation. I have a h2.block-title where I change the color, ...
1
vote
1answer
28 views

Core JavaScript is not included in all pages

I'm developing a theme in Drupal 8. This is my theme.libraries.yml file: default: version: 1.x css: theme: css/bootstrap.css: {} css/style.css: {} css/font-awesome.min.css: {} ...
3
votes
1answer
25 views

Adding jQuery to a view (exposed filter: search terms)

I'd like to add some jQuery (for search highlighting) to my Drupal 7 Views with exposed search terms filter. The point is that when a user clicks a search terms (or terms) the jQuery then highlights ...
0
votes
1answer
22 views

How to remove Quicktabs cookie on certain page?

I found a useful snippet here to make Quicktabs remember which tab was open if the user leaves the page and then comes back again. My problem is that I want to remove the history (the cookie) after ...
1
vote
0answers
34 views

Using Bootstrap Tabs in CKEditor Module

Using the ckeditor module for Drupal 7, my content admins want to tab through the different bootstrap tabs in the ckeditor so they can modify/add content as necessary. For example, in the image below, ...
0
votes
0answers
18 views

Webform onchange added with hook_form_id_alter

I have a webform on a Drupal 7 site I am working on with a form ID of 144. I have a module that alters this form to add default values to the fields within the webform. This is all working fine. I now ...
0
votes
0answers
15 views

How to access low level fields in the best way?

I have the module Google Store Locator. In the rendered data of the stores, I wanted to drop the Country name. I had to go the the content type - Store Locator -, and check a few options (see image ...
0
votes
1answer
38 views

Drupal 8 JS and CSS imagepath

Do I need to hardcode the image path to JS and CSS files ? like in css: #mydiv { background: url(http://example.org/themes/mytheme/image/bg.png); } I cannot use in .js and .css files the {{ ...
0
votes
2answers
21 views

Jquery after ajax loaded in view

So I created a view listing all the users. I implement a search form with autosubmit function. The autosubmit works with an ajax script. Into my page view, I changed a few things in Jquery like this ...
1
vote
0answers
13 views

How can I access the value of 'contacts' outside of the navigator.contactsPhoneNumbers.list()?

When I implement this code with DrupalGap, I want to access the value from the function in the navigator.contactsPhoneNumbers.list(), outside if it. I want to create a variable with the HTML table ...
0
votes
3answers
48 views

Need clarification on adding JS to content item with JS injector and drupal_add_js

I want to put some js on my article. Original code form http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_hide_p is: <!DOCTYPE html> <html> <head> <script ...
0
votes
2answers
33 views

Where is the jquery.cycle.all.js file?

So i have install views_slideshow_cycle module, and it always shows "cycle" is not a function. after some googling, I found out I have to install jquery_cycle. In views_slideshow_cycle.libraries.yml ...
0
votes
1answer
24 views

How to expose variable from php to js - and keep it updated?

drupal_add_js works to pass variables from php to javascript, and there are plenty of examples. But I want the variable to update without a new page request. I have a page request that kicks off some ...
0
votes
1answer
106 views

Why is it considered improper to directly add an `onclick` attribute to an HTML element?

From a Drupal perspective, why is it considered improper to directly add an onclick attribute to an HTML element instead of using a Javascript behavior?
1
vote
0answers
41 views

Smooth Toggle Menu on Bootstrap sub-theme

I'm using Bootstrap 8.x-3.0-beta2 on Drupal 8.0.1. Originally the menu allow you to expand one at a time. I added the following smooth toggle code for animation effects. $(function(){ $('li ...
3
votes
1answer
53 views

How to add JavaScript or CSS library to Composer project?

For some cases, there is the need to add a JavaScript or CSS package to a project. One of those cases was the DropzoneJS package for the drupal/entity_browser. All recommendations I could read online ...
1
vote
0answers
8 views

Search results also show code

I have created some nodes containing Javascript code into body field using Php filter. I also have tried by using Full Html filter. Now when I search through default drupal search then result list ...
1
vote
1answer
18 views

“Click to show” text at pages

How can I implement "click to show" some text data at pages? Also I need to save log in database about events. I've found tiny module Field Value Loader (Show field on click) Is there any similar ...
0
votes
0answers
15 views

Is there a way to add JS to a page node Head tag directly from the page editor?

I am using Google Experiments for split testing and I need a different script for each page. Adding a different script per page can be tedious if there is no way to add the script from the page ...
0
votes
2answers
49 views

Problems getting Carousel jQuery plugin working

I am trying to get a Carousel on my site, but I am having problems. I want to install http://www.jqueryscript.net/slider/Full-Width-Responsive-Carousel-with-jQuery-Bootstrap.html. I have created a ...
0
votes
0answers
23 views

Ajax Response from modal-embedded form always results in redirect

I have the following form: https://gist.github.com/j-hall-ctidigital/53e26cd23d6f8416f86f Which is embedded into a modal using AjaxResponse from another form: ...
4
votes
2answers
125 views

How to add jquery lower version for a particular drupal page?

I have installed the jQuery Update module and set jQuery 1.10 as default jQuery version, but one of my previous functionality stop working. I just want to use jQuery 1.8 for a specific page. How can ...
1
vote
1answer
51 views

What is the best open source Image Zoom plugin for module? [closed]

It seems like there isn't a decent image zoomer solution for Drupal that works on mobile and desktop. The best solution in my opinion is the Cloud Zoom module but it is outdated and Cloud Zoom isn't ...
0
votes
0answers
27 views

Call form validation function by clicking link

I want to be able to click a link on my form and have it call the form's validation function (but not actually submit it!). Here's what I've got that's partially working: in form_alter: ...
4
votes
1answer
56 views

How do I submit call handler on radio button selection?

I use the advanced polls module in Drupal 7. I am trying to alter the behaviour so that the vote is submitted as soon as the radio button is selected (without having to hit Vote). The module is using ...
0
votes
2answers
92 views

Attaching a JS library to every page

I'd like to attach a javascript library to every page call. I created a directory for my module called flot_d8 I created an info file, lot_d8.info.yml. My understanding is, the libraries section ...
0
votes
0answers
13 views

How to get user agent and referrer in Webform 4.x form results via javascript?

Is there a way to retrieve the user agent and site referrer and populate a hidden input component field in webform 4.x or is there another alternative way to solve this issue? I want to be able to see ...
0
votes
2answers
35 views

Implement parallax effect on Header image from Content type field

I have a Header image which i can upload per node from my Basic-page Content type. I want to implement this parallax effect, on my Header image section. But I need to add: <div ...
0
votes
1answer
36 views

GMAP Module map not showing markers after updates with js error: Clusterer is not defined

I've recently taken a live site down for updates and development. I have updated from core 7.39 to 7.41 and updated numerous modules including jQuery update. After the updated, I noticed that my map ...
0
votes
1answer
37 views

fastest between hook_js vs hook_menu to get JSON via REST

I'm trying to figure out if in my case it makes sense to use the High-performance JavaScript callback handler module. Between js/MODULE/example.json (hook_js()) and example.json (hook_menu()), the ...
0
votes
0answers
23 views

Adding JQuery QRCode plugin to Block (Drupal 7) [duplicate]

I want to add a QR Code to a currently viewed Node but not had much joy in understanding how to do it. I've found https://larsjung.de/jquery-qrcode/ module and also ...
0
votes
1answer
36 views

How do I clear settings from the Drupal object?

I have a module, which renders an AJAX form, which passes data to a script via drupal_add_js and stores it in the settings property of the Drupal object. My problem is that I cannot seem to remove old ...
0
votes
1answer
28 views

How do I add JavaScript?

I'm creating a website and I want to display a widget from another website inside a block. In the widget description, I have this information: Paste this code at the top of your website code, ...