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

learn more… | top users | synonyms

0
votes
0answers
10 views

Having trouble selecting elements in jQuery with JS added on the form

I have a form with a file element and a button. When I click the button it is supposed to run some JS. I have tried three separate ways to get this to work but each way gives me a different result. ...
0
votes
1answer
16 views

Changing color of form html with Javascript

I have some custom HTML and CSS added to a form module I've created. It looks fine; the css is styling it correctly with a drupal_add_css() stylesheet. But I also want to add some Javascript using ...
1
vote
1answer
21 views

Before I install this module I want to better understand this note

I want to install the Autosave module. In the module's page there is the following note. Can someone please clarify it for me in more simple words? I wonder if it could clash with other modules that ...
0
votes
0answers
15 views

JavaScript works in console, not on site [closed]

I added this js file to the Drupal site through the theme's .info file. The code works perfectly when I test in in the console, but nothing happens on the site. This is a script that takes long ...
0
votes
1answer
11 views

Javascript variable value in page source for seo from Drupal.settings

Declared a variable in settings.php $conf['my-variable'] ="my-variable-value"; Added inline javascript drupal_add_js("array('my-variable'=>variable_get('my-variable'))"); Need to print ...
0
votes
4answers
37 views

Pass php variable to javascript

I'm trying to pass variable to my js file. The file is located in my theme /js directory. The filename is backgroundConfig and this is the content of file: (function($, Drupal){ ...
0
votes
0answers
21 views

Populate an input textfield (FAPI) with a jquery virtual keyboard (custom block) [closed]

I'm trying to set up a web app developed with Drupal that will be only accessible with an iPad, locked in a secure enclosure, to let the clients of a bar enter their phone number each time they visit ...
-1
votes
0answers
9 views

Need Help with CTools Modal

Can the CTools Modal.js load more than 1 modal at a time. Basically i need 6 modals loaded on dom, but only show one. To reduce load time of the modals. Is this possible. Many Thanks
0
votes
2answers
25 views

Using drupal_add_js with google maps

I want to pass down an array to my javascript. So that i could create markers on google map. By doing this: ...
0
votes
0answers
9 views

Building complex Javascript on top of but apart from Drupal

Does anyone have any thoughts on developing significant Javascript functionality on top of but separately to a Drupal site? I have started working on an old Drupal site (dealing with written, news ...
0
votes
0answers
21 views

Javascript that I add to page dosnt seem to run

The thing I want to achieve is that on a specific page my module places a google map with markers on it. Here is how i do it: First I add this: $setting = variable_get('locationUrl', ''); if ...
3
votes
1answer
24 views

Scope javascripts to be outside admin

Now when we are almost there using purely YML files to include JavaScript, is it possible to include javascripts everywhere except for in the Drupal administration? Beta 4 does not allow the #attached ...
0
votes
0answers
29 views

Need to change order of js in Drupal 7 [duplicate]

I have js jquery 1.10.1 min js which append after drupal.js. Due to that i got following Error: "Uncaught ReferenceError: jQuery is not defined drupal.js 5". So how can i change the order of js so ...
0
votes
0answers
56 views

Drupal 7.x duplicate file js ?? Why?

I don't know beacuse drupal duplicate one of my javascript files... So: I had added file "Intro.js" with template.php. I wrote: if(drupal_is_front_page()){ drupal_add_js(path_to_theme() . ...
1
vote
1answer
20 views

How do I load all images and thumbnail for a multivalued image field in node view?

I have a content type with a multivalued image field. I want to make the image field render with one main image and all the thumbnail. When any of the thumbnail is clicked then it's respective image ...
0
votes
0answers
15 views

Using EmberJS as a FrontEnd to Drupal

I am just starting to learn more and more about Headless Drupal, and have developed an interest in combining it with an MVC framework like EmberJS. I've only found one good talk on the subject, but ...
0
votes
1answer
16 views

Firing ajax_callback on textfield after a minimum number of character

Ive created a textfield with an ajax callback with 'keyup' event. In need the callback function to be fired only after a certain number of character ... I can control the number of character of the ...
0
votes
1answer
30 views

Drupal Form Button + “Are you sure”-Button

I am trying to add an own JS function to a Drupal Core Form - think Config, Development, Clean Cache. This function basically just asks if the user is sure. Here is what I have so far: ...
0
votes
0answers
20 views

“Reset” all flag

I'm working on a site that uses the flags module. each user needs to be able to "reset", or "clear" all the flags they have set with a single button. The button is displayed from a content block that ...
0
votes
0answers
12 views

Enter key act as Tab key on Textbox in Drupal theme

I am using drupal a Content Type as data entry that contains more than 25 Textboxs. How can I make enter key act as Tab key on Textbox in my drupal theme? I tried a lot of codes like this: ...
0
votes
2answers
123 views

Javascript: Drupal.media is undefined

When I try to upload an image through anything other than the admin/content/media interface, I get an "Drupal.media is undefined" error. Uploading an image through the interface does work. Using the ...
0
votes
1answer
19 views

Turning View into flashcard

I am working on a requirement to display a 2 column (question and answer ) view into flashcard . question should appear on front and on flipping the answer should appear . I am not sure whether such ...
-2
votes
0answers
31 views

Integrate existing Drupal website with oauth2 based SSO system

I have an Existing Drupal website and another SSO system which authenticates using oauth2. For authentication user have to redirect to the SSO website and after successful login he is redirected back ...
2
votes
1answer
52 views

jQuery events are lost after form reload

First I thought that this would not be a Drupal specific problem, but jQuery specific solutions didn't solved it. I hope you have some advices. I have a form with lots of fieldsets. To find the right ...
0
votes
1answer
35 views

Javascript added via drupal_add_js() does not get aggregated

I have a couple custom modules that I add javascript via drupal_add_js(). I have all the Bandwidth Optimizations options checked in the performance page (/admin/config/development/performance). Since ...
-2
votes
1answer
30 views

Problem with custom scrollbar when it is called more than once on the same page

I making my custom module that works through Views and I have problem with one part of it. In one part, when I have longer text, custom scrollbar appears, and it works without any problems, but when I ...
0
votes
1answer
41 views

CSS not working after Commerce AJAX processed on field

I have got a problem with css after Drupal processes radio buttons on Drupal Commerce product page. Radio buttons are formatted (images instead of typical radio) Formatted radios After clicking ...
0
votes
1answer
29 views

a little javascript help [closed]

I'm trying to pass some basic tracking information into a javascript snippet. this is the example they provide. woopra.identify({ email: "johndoe@mybusiness.com", name: "John Doe", ...
-1
votes
1answer
27 views

Javascript closures in modules [closed]

I am trying to adapt some code I have written in javascript outside Drupal to a Drupal module: (function($) { Drupal.behaviors.myModule = { ...
0
votes
2answers
87 views

How to get a list of all javascript files in a directory

Is it possible to get a list of all the javascript files in the libraries directory? So far I have tried using files_scan directory but it's not returning anything: $dir = base_path() . ...
4
votes
1answer
95 views

Sending client to channel messages with nodejs integration

I've been struggling with this for some weeks now and so far I have not found a proper solution yet. I guess this is a bug, but since there is no response on nodejs issue queue I'd like to ask this ...
0
votes
2answers
27 views

Safety of letting user define javascript paths in fields

I have a module that uses the Fields API to insert a HTML5 canvas element and allows users to define paths to user scripts to be loaded with the page: The scripts are relative to a hard-coded path ...
4
votes
1answer
77 views

How to pass Javascript variable with form on submit?

I want to pass a variable created with Javascript to $form_state so that I can use this variable in the form_submit function. In an ajaxified form I can use: ...
0
votes
0answers
26 views

Sending information from JS to Module File

In one of my webpage I print one button multiple times and all have different logId. I want that when user click then there will JQuery into the picture and there should be no server side post-back. ...
0
votes
1answer
21 views

Built-in AJAX versus custom AJAX

As the title suggests, I would to know what are the pro and cons of use Built-in ajax of drupal compared to a custom ajax code. I created 100 <li> with images on a page through a callback ...
0
votes
1answer
24 views

javascript code wrapper

While using drupal 7, is it necessary for to wrap pure javascript code with jquery wrapper? (I understand that while working with jquery, I need to wrap my code inside beaviors.) code function ...
0
votes
0answers
32 views

Why isn't this theme's script.js executing?

I've got an Open Atrium 2 (7.x-2.25) site, using the default Open Atrium Radix (7.x-3.5) theme. It uses the Mobile Friendly Navigation Toolar (7.x-1.0-alpha10+8-dev), but with a customised 'Open ...
3
votes
1answer
45 views

What's the event triggered after an autocomplete has run and how to retrieve the value selected

I have a node add form with a term reference that uses autocomplete widget. I want the "tid" of the filled term by the user using the autocomplete widget.
0
votes
1answer
39 views

How to add a javascript field to custom content type

I have a custom content type called 'Visualisation'. I would like a user to be able to upload their own javascript file for each instance of the content type. I would then like to load this script on ...
0
votes
1answer
105 views

Enable bootstrap tooltip and popover (on a bootstrap based theme)

I'm using a theme based on Bootstrap 3. I want to use Tooltip and Popover features that come with Bootstrap but I couldn't. It's said on the Bootstrap Javascript page that: Opt-in functionality ...
-2
votes
1answer
93 views

jQuery - 'once' won't apply a toggleclass after a click action [closed]

I want a click on #parent to toggleClass a 'newclass', on the parent's child element, 'child'. The page has an AJAX call, so I need the function to only apply on page load. However, I can only get ...
0
votes
0answers
19 views

View modal window only once

This code displays the Welcome modal window on page load on the Landing page, and also when the page is refreshed. The Visitor only needs to see it once as they navigate the site and return back to ...
0
votes
0answers
23 views

How to disable swipe up and down for Views Slideshow

I have been trying to implement a swipe function for Views Slideshow. I was able to find this script: I works well for the swipe left and right but I am having troubles finding the option on how to ...
0
votes
2answers
83 views

Drupal and Require.js not playing nice - double load of jQuery

I’ve been given a design library from a large cooperate client built utilizing Bootstrap 3 and Require.js. It’s very robust and well-built with the various scripts using Require.js to load jQuery. ...
0
votes
1answer
36 views

Where to write a jquery script for a registration form page which created using webform module in Drupal 7?

I have created a registration form page using the webform module. The registration form page contains personal info and billing info groups with fisrtname, lastname, email, age fields and a check box ...
1
vote
1answer
53 views

Drupal JS add noscript after every <script> tag

I'm looking for a way to add the noscript tag after every tag. Even the file tags. I cannot have alternatives as the client I'm doing this for has made this mandatory for 508 purposes. I believe the ...
0
votes
0answers
49 views

How to call a JavaScript function inside the form_submit?

My problem is exactly as the title of my post shows. How should I call a javascript function inside the form_submit hook? I just need to call a function which is previously defined in a javascript ...
0
votes
0answers
38 views

Is there a way to retrieve DRUPAL TWIG template's with core drupal 8 javascript functions like twig.js?

Is there a way to get precompiled twig templates from drupal 8 ? Example : Drupal.getTemplate('my-template.twig')(data); Thanks.
0
votes
1answer
26 views

Javascript link in theme.info not working Drupal 7 [closed]

Why is my jquery.js file not found when I use this code in my theme.info? Im using drupal 7. scripts[] = js/jquery.js I got this code from the drupal page and I'm 100% sure its the right path. ...
0
votes
0answers
27 views

Apply “autoInside” setting

I'm using Drupal Commerce Kickstart's Cloud Zoom and it does not seem to have a UI setting to control zoom position on large and small screens. On larger screens, the zoom position should be right of ...