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

learn more… | top users | synonyms

3
votes
2answers
91 views

Why do I need to use .live() in Drupal Behaviors?

I am trying to be a good boy and use Drupal Behaviors to manage my JavaScript. My understanding is that one of the advantages of using Behaviors is that it frees you from having to use .live() to bind ...
5
votes
1answer
125 views

How does CSS and JS aggregration work in Drupal?

When Drupal is set to optimize JS and CSS, it creates the 'js' and 'css' folders in your public file system root. Aggregated JS and CSS get stored in these directories. I've tried to figure out how ...
0
votes
0answers
14 views

How to add Javascript in Drupal 7 with jQuery?

I am trying to provide the option that users be able to put comment under each paragraph. So at the end of the article, I have something like this: Comments for paragraph 1 /* here I show the ...
0
votes
0answers
8 views

Creating item library, allowing user to make selections and publish to another page

Above is a rough MS paint concept I banged out to illustrate what I'm trying to do. I need to create a library of items, which have pictures, descriptions, names, etc. This library will be ...
0
votes
0answers
23 views

behaviors javascript executing

I want to pass params via Drupal to my JS file. I have no problem fetching them with the code below, the problem is that as the $(document).bind('leaflet.map' function executes FIRST, it is not able ...
-1
votes
0answers
19 views

How can I aggregate javascript in a per role basis? [closed]

I have different JavaScript for different roles, and would like them aggregated separately. How can I do that?
1
vote
2answers
44 views

D8: How to perform ajax call in javascript

I'm trying to perform an ajax call from a javascfript file by executing this: $.ajax({ url: '/lunapark/ajax/space-invaders/' + score, success: function ...
0
votes
0answers
16 views

QTip Load in library [closed]

trying to install qtip. It says in the requirements you need a CDN. I downloaded jsDelivr and I setup. This is the js I get from it http://cdn.jsdelivr.net/qtip2/2.2.0/jquery.qtip.min.js It does not ...
1
vote
0answers
12 views

How to use photoswipe script in Drupal 7

I want to use photoswipe script on my site to preview images. I downloaded the script, copied two JS files code-photoswipe-1.0.11.min.js and simple-inheritance.min.js. Include them in a file ...
0
votes
2answers
19 views

How can I add “x-tmpl” script tags to the page for use by Backbone/Mustache?

I'm building a D7 site that uses Backbone to parse JSON data (from Views JSON), and then feeds it to a series of Mustache templates for rendering with Javascript. I want to keep the Mustache ...
1
vote
1answer
31 views

advagg drupal module breaking my js file

I am using advagg module to improve my website performance and I also using date picker jquery UI function for date functionality. I have datePicker intialization $( "#datepicker" ).datepicker(); . ...
0
votes
1answer
22 views

How can I include a custom JavaScript file such that it can access and bind events to DOM elements?

This is my first time writing custom JavaScript for Drupal, and at the moment I am attempting to bind onClick events to buttons within a block generated by a view, but I suspect I am approaching this ...
0
votes
1answer
22 views

Perform action on logout,

I would like to add javascript on logout. I tried using hook_user_logout but the javascript doesn't get added. Even adding something as simple as drupal_set_message doesn't result in a message ...
0
votes
1answer
34 views

Submit few forms in Drupal 7

I try to add Poll-voting to my website, on page I addet 5 votings forms, I try to make submission of all 5 forms by one click instead of 5 clicking. I wrote this script : <script ...
0
votes
0answers
7 views

ckeditor interface language for multilingual site

I am trying to implement various languages in ckeditor interface for my multilingual site if i set config.language = 'en-gb'; config.wsc_lang = 'en_GB'; config.scayt_sLang = 'en_GB'; in admin panel ...
0
votes
0answers
9 views

when i onclick radio button then it's value should display in textfield [duplicate]

here i have two radio buttons radio button "One" and radio button "Two", when i click/check on radio button "One" then then it's value should display in textfield of "Display". ...
0
votes
1answer
43 views

when i onclick radio button then it's value should display in textfield

above is the sample screenshot of my form where i would like to do is: when i click/check on radio button "One" then then it's value should display in textfield of "Display". Code: function ...
-1
votes
0answers
9 views

What module lets you embed inline images where you can enlarge using lightbox/colorbox/yoxview?

What module or modules give you the ability to add inline uploadable images to your body content where you can click and have it enlarge with any of the available image enlarging libraries? colorbox / ...
-1
votes
0answers
10 views

this page includes a script from unauthorised source

When I open my site in chrome i see this message "this page includes a script from unauthorised source" what would be the cause of it.? And how can i remove this ?my site is working on https protocol ...
1
vote
2answers
35 views

Update Two select box when change another select box

I have drupal form with three select box i want to change select box 2nd and 3rd after change value of 1st select box. ex: i have Three select box 1) Cruise line 2) Destination 3) Ship Id When ...
0
votes
0answers
20 views

Show content of custom password field on mouseover

I need to hide a custom password field content and display it when a user needs to see and copy it. Using Password Field module is one way to go. But then Password Toggle module doesn't seem to ...
-1
votes
1answer
34 views

on-page javascript not interpreting query string

I've got a question today about on page javascript that writes then is supposed to read a query string. I'm working with a third party tv station finder that has provided me with a snippet to drop ...
0
votes
1answer
32 views

How to make sure my behavior is triggered before AJAX?

I have a form elements that looks like this: $form['properties'][$property->idProperty] = array( '#title' => $property->Label, '#ajax' => array( 'callback' => ...
2
votes
1answer
84 views

Internal/External JS don't work with Drupal, but works fine in static HTML/JSFiddle

Continued from here Applied JS to Drupal theme doesn't work correctly, but it works fine outside Drupal Working JSFiddle: http://jsfiddle.net/tbq8eo8b/10/ (it calculates total, in Drupal it ...
0
votes
1answer
28 views

Applied JS to Drupal theme doesn't work correctly, but it works fine outside Drupal

Applied this JS http://jsfiddle.net/tbq8eo8b/10/ to webforms. As you can see in fiddle, it calculates total amount. When in Drupal, it gives 0 no matter what amounts you select, it always prints 0. ...
1
vote
1answer
63 views

How to pass node ID argument to Drupal 7 div auto update ajax script

EDIT: There seems to be a ready-to-use http://drupal.org/project/block_refresh module available as @albertski indicated, so no need to struggle to develop a new module. I've implemented the code on ...
0
votes
0answers
25 views

JS: Handling click event on element created by another module's JS

I've got two modules, one of which handles a button which makes all menus retract from sight, and another which handles a cycling background gallery. I'd like to switch from a "blurred" to a regular ...
0
votes
1answer
12 views

How do I find out what added code to the $closure of my theme?

I have code in the $closure variable of my theme and I don't know what added it to the theme.
0
votes
1answer
27 views

Why Cant add a class to an element by jquery [on hold]

In the page.tpl.php I have some elements like <div class="play"></div> I have linked js file to the page and it is correctly works since all functions operate based on click ...
0
votes
0answers
23 views

fivestar module js breaking my custom js

My problem is when I use five star module on any page my js gets break on that particular page. I don't know what I am doing wrong
3
votes
1answer
110 views

Using Grunt.js with Drupal [closed]

I'm in need of an organization system for my JavaScript code Drupal. Currently, I've got it inside a folder in my theme's directory: "sites/all/themes/mytheme/js". I've looked at using Grunt.js, and ...
0
votes
2answers
205 views

Want to show/hide multiple divs based on dropdown box selection

I've tried looking around and there are similar problems, but mine is way more simple, but yet, I can't find a solution within these forums. This is the dropdown markup. <select id ...
1
vote
2answers
30 views

Javascript works inline in webform but not as standalone

I have a javascript that works if I place it in a mark up in my webform but breaks the form if I make the form a multipage. If I place the script as it's own file and then call it using ...
0
votes
2answers
103 views

javascript does not work after form load through ajax [closed]

I am using field collection module for showing some fields with add more option using ajax built in functionality of field collections. in my field collection I have added some javascript on some of ...
2
votes
2answers
78 views

Drupal 7 website layout/styling breaks all a sudden (random), how to debug? there are no logs

One of my websites running Drupal 7 goes out of format, most often when user login. This is how it should be After running out of format this how it looks This may be a CSS issue, it may be a ...
-2
votes
1answer
42 views

How can I pass an array of variables from php to javascript? [duplicate]

I use this but cannot find solution. drupal_add_js( array('YOURMODULE' => array( 'testvar' => $testvar )), array('type' => 'setting') );
0
votes
1answer
23 views

Load .js only if block is loaded

Yes, something like that. If block and it's content are loaded in the page (so I guess detect by ID or something) it would load the .js, but if block is not loaded, it wouldn't load the .js. I need ...
0
votes
0answers
23 views

How to get the value of a content type field in Drupal and pass it to a JS file

In my Drupal theme I have a field for soundCloud URL which its machine name is (field_soundcloud_url_) I have a javascript file that will work based of the value of this variable. But it does not ...
0
votes
0answers
41 views

Inline javascript in drupal_add_js is causing WSOD

In my template.php i am executing some inline javascript code. When executing, the result is a white screen of death (WSOD). The web servers error log says: PHP Parse error: syntax error, ...
0
votes
0answers
32 views

turn js not working in colorbox but works fine on nodes pages

I have manually integrated turn.js script in my drupal 7 website which works perfectly and converting the images in a flipping book. I did that by creating a content type added a multi value image ...
1
vote
1answer
20 views

Script Not Working [closed]

I am trying to integrate 3rd party jquery plugin Turnjs 3rd edition available on github in my website. For this I have uploaded turnjs script on my server and called it in website through my ...
0
votes
2answers
74 views

drupal_add_js settings and working around the anonymous page cache

What I'm trying to do is allow registered users to configure a few colors on public facing pages (profiles, etc.) and to do so I'm using the ColorField module and a few theme functions. My problem is ...
1
vote
2answers
25 views

Uncaught TypeError: Only on Drupal edit pages

I'm using the BigSlide.js sliding menu on my drupal site, which i've built into the theme, and it works fine on every page, apart from on /edit/ pages. E.g. user/%/edit. When clicking the target menu ...
0
votes
0answers
21 views

Change text size on a page with callback

I must add buttons on my site to change font size by the user, an accessibility option. Additionally, after user changes the font size, my custom javascript function must be called as a callback after ...
0
votes
1answer
82 views

How to prevent newline character in textarea

I'm building a form in a module for Drupal 7 and I want to add a textarea as I would like it to be multiline so that text overflows on the next line, etc. but I don't want users to be able to create a ...
1
vote
1answer
404 views

How to attach Dropzone.js uploads to a form element

I'm integrating dropzone.js into my form, but I have an issue regarding my file uploads. I have my dropzone set up, and file uploads are in the $_FILES array. I want to call file_save_upload to ...
0
votes
0answers
20 views

Loading resources(CSS, JS, layout images) for multi-site from same path

I am working on a website with more that 500 subdomains. All the subdomain have same code and different databases. The problem I am facing right now is that whenever I add any CSS change, I have to ...
0
votes
1answer
31 views

My website suddenly started giving Error 200 on anything AJAX related!

The other day my website suddenly started acting weird. When using the Flag module to flag content, i get a 200 error! The content does get flagged once i refresh the page, but when clicking the flag ...
0
votes
0answers
24 views

hook_js_alter not being called

I find this strange. My module seems to be named correctly but the module will not be called. The var_dumps are not on the page nor are watchdogs when I put them in. The module shorthand is ...
0
votes
1answer
23 views

javasript invoking custom module to update user response

I have created Multiple choice questions in drupal . One node (page ) has one mcq . The answers are displayed by simple radio buttons and javascript . Now I am planing to give some dynamic behavior ...