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

learn more… | top users | synonyms

2
votes
1answer
19 views

How to add javascript after form was validated with ajax callback?

I created a simple form. How could I add JavaScript commands after form was validated? Why is it so hard do this? $form['submit'] = array( '#type' => 'submit', '#value' => 'submit', ...
0
votes
0answers
21 views

End Date always after Start Date?

Related to, but not the same as Change end date automatically after changing start date I'm looking for a method to have Date fields do some sort of validation on the end date. I don't want it to get ...
0
votes
2answers
17 views

Can a javascript variable be made configurable?

I defined a variable in my .js file and want the user/client to change that as per his needs. Is it somehow possible to use that value in forms in drupal?
-1
votes
0answers
21 views

Passing Javascript variable in my module file [duplicate]

How can I pass a JS variable to my module file using ajax in drupal? var start; start = new Date().getMinutes(); window.onbeforeunload = function() { var end1 = new Date(); var end = ...
0
votes
1answer
21 views

How do I add a Javascript library to a field formatter?

I'm trying to include a Javascript gallery (jQuery lightGallery) on my new Drupal 8 site and wrote a field formatter for this purpose. Now I need to add the jQuery lightGallery to pages using this ...
0
votes
2answers
44 views

How to record what time user has spent on my node?

I want to record the time a user has spent on my particular node so I could show a pop up to the user to register once the user has read 3 article. But the user must have spent at least 30 seconds on ...
0
votes
1answer
17 views

Is there a way to check user permissions in javascript?

Is there a way to check user permissions in javascript? I have a segment of code that I only want visible if the user has the proper permissions, and I think it would be easiest way to check the ...
0
votes
1answer
16 views

Duplicate / Triplicate inline javascript

On some pages of my site when inline javascript has been added to page it get added multiple times. I've looked through my base theme (Zen) and my default theme (custom) for anything that may be ...
0
votes
1answer
24 views

Error on Insert Map

I am using Drupal 7 and the Google Map Field module. When I click on the Insert Map button, the Firebug console shows this: TypeError: $(...).prop is not a function It seems like I need ...
0
votes
2answers
30 views

How to do integrate javascript in drupal way

I want to integrate this Flex Slider code to drupal but without success. Please help. here is the code if($('#homeSlider').length > 0) { var hIndex = 0; var $hCap = ...
2
votes
1answer
19 views

Need help Converting a jQuery event to a Drupal Behavior

I have a Drupal 7 web site that is using jQuery animations to fadeIn div tags. I need an event to capture a fadeIn when it is completed. I have found a sample jQuery example that does what I need it ...
0
votes
0answers
4 views

Hooking into tableDrag onDrop event when using draggableviews

I am using draggable views module in one of my projects, and it works like a charm. ;-) I now want to "hook into" the onDrop event in one of my custom modules to add some logic there (altering an ...
0
votes
1answer
12 views

Can't open these tabs in my Browser

I'm working with my college on a drupal website. However, we're both logged in as Admin, but I can't open these tabs. He says he has no problem with it and told me it could be a Java problem. I ...
3
votes
2answers
66 views

Where should I store 3rd Party external js libraries?

This is a follow up to Define JavaScript library in Drupal 8 I have a third party library that I don't want to bundle with a module. In Drupal 7 I could just ask the user to extract to ...
1
vote
0answers
14 views

WYSIWYG TinyMCE add Custom Javascript

So I am running into the issue where I can't add any custom javascript to elements inside the WYSIWYG because its an iFrame. Is there some special way of adding custom javascript. The main thing I ...
0
votes
1answer
36 views

Create node from JSON

I'm looking to write the following module, any help, guidance, and advice would be greatly appreciated. User is logged into site. Site has two content types: page & note. Logged in user can ...
1
vote
0answers
25 views

Views display tabs remember last tab(need help with adding cookies or use $_session)

hey im using Views Display Tabs to display 2 pages of view and allow the user to switch between them however the last selected tab doesnt save and i want it to do that i have tried a few things that ...
0
votes
1answer
26 views

jQuery scripts not working on my Drupal theme

This script from JSFiddle that works: https://jsfiddle.net/ryXFt/704/ Does not work in my Drupal theme (yes, it does load, I can see it via Firebug). All I do is just wrap up the code to match Drupal ...
2
votes
2answers
46 views

Why does external js only appear in header? D7, in a block, via custom module

I'm trying to add a box.com file upload widget to certain pages in a block. The upload widget is an external js script. I'm adding it via a custom module, using hook_block_view, switch ($delta) { ...
2
votes
2answers
51 views

Webform live calculations in table/matrix

I am trying to create a work time allocation webform. My goal is to create a table (6 columns and addable rows) and get a live sum of all columns at the bottom. (edit: pardon my lacking terminology. ...
0
votes
0answers
16 views

Is it possible to insert php values into added javascript files in Drupal? [duplicate]

In Drupal javascript files can be added for example by drupal_add_js() function, or (in my case) attached by form API: $form['#attached']['js'] = array( drupal_get_path('module', 'activit') . ...
0
votes
0answers
16 views

How to use tabledrag within multiple tables

I have a form that has three groups of elements which are presented via tabledrag form element. I would like to be able to move the rows between the tables, so not just within a single table as ...
1
vote
2answers
79 views

How to animate set of titles of a View using JQuery

There is a View of latest news title linked to the node page and I need to display them like this Effect. I've trying to do it by creating a new template file for my views named: ...
2
votes
2answers
76 views

Why are the CSS files in my .info not applied (scripts work fine)?

I have a list of CSS files from a premade theme called artifical reason they are listed in my .info file as such stylesheets[all][] = assets/css/style.css stylesheets[all][] = assets/css/preload.css ...
0
votes
2answers
25 views

How to conditionally load javascript file on view page

I'm trying to load some theme javascript only to one view(multiple displays). I've tried to use the views preprocessor funciton, but maybe I'm doing it wrong: function ...
0
votes
2answers
27 views

Translate string in javascript

There is a string which gets displayed in the mobile menu. var arrowimages = { down: 'downarrowclass', right: 'rightarrowclass' }, $mainNav = $('#navigation'), $mainList = $mainNav.find('ul').eq(0), ...
0
votes
1answer
26 views

Add JavaScript to a page without access to core files?

I apologize in advance if this is a really simple question, but I'm pretty new to Drupal and still figuring out my way around things. So I was wondering if it is possible to add JS to a certain node ...
0
votes
0answers
13 views

Static Leaflet Labels on Leaflet Maps in Drupal 7

I'm using the leaflet label module which creates labels on markers and polygons upon mouse hover. This module uses the leaflet library found on github. I'd like my labels static so they load when the ...
1
vote
1answer
13 views

Is there an easy way to include a Facebook remarketing tag in my D7 site?

Adding Google Remarketing Script tags to Drupal 7 website shows how to add a Google remarketing tag using a module. Is there a similar solution for adding a Facebook remarketing tag easily? I would ...
1
vote
0answers
23 views

Drupal alter some javascript of contrib module?

I am working on a project that implements the Drupalchat module. Everything works perfectly, but the client requests some custom changes. They want people to be unable to have private conversations ...
-1
votes
1answer
31 views

Where to add Drupal.t function in a javascript [closed]

Hi I have a string in a string that needs to be translated. What needs to be added to this line to get it done? $(language).find('.content').append("<div class='voice-next-step'>Next ...
0
votes
0answers
13 views

Leaflet Map disappears when selecting term in views exposed filter

I'm using leaflet in a content view with a page having an exposed filter on taxonomy terms. Problem is whenever a term/filter is selected and applied the map disappears and turns grey. I'm using ...
0
votes
1answer
18 views

Leaflet - Possible to go straight to node instead of popup on click?

I'm using the leaflet module in drupal and would like the user to go directly to the node instead of a popup when clicking upon a marker or polygon. Is there a way to do this?
0
votes
1answer
73 views

Calling Jquery function from link onClick attribute

I'm trying to call a jQuery function from a link's onClick attribute but I get the following error: Uncaught TypeError: Drupal.behaviors.main.test is not a function. I created a simple module that ...
0
votes
1answer
28 views

Remove inline JS from specific page type?

This is an answer how to unset js from specific page types: http://stackoverflow.com/questions/10138660/how-to-remove-css-and-js-from-a-certain-content-type-in-drupal-7 And I've made it for Syntax ...
0
votes
0answers
20 views

How to avoid Onclick event returning old output along with new output

Using db_select got the data(path to csv file) from database, bind it to table(themes) and returned table as output. Each row in the table as hyperlink named "Plot" as shown below. When user clicks ...
0
votes
0answers
6 views

Solid Black Polygons in Openlayers - How to change color and opacity?

I'm using the openlayers module for a map in Drupal. When I draw polygons on the map they appear as solid black. How can I change these to a color with opacity? I'm guessing this is changed at the ...
1
vote
0answers
35 views

Reorder Javascript loading in theme?

Some modules insert JavaScript in top of list. I put my $sctipts variable in the bottom of html.tpl.php file befory body closed. So this become some scripts do not work cause the declared before ...
0
votes
0answers
49 views

Justified-Gallery in Drupal 7

I am trying to implement Justified-Gallery: http://miromannino.github.io/Justified-Gallery/ in my Drupal 7 website. I linked justifiedGallery.min.css and jquery.justifiedGallery.min.js. The thumbs ...
0
votes
1answer
23 views

ReferenceError: Progress is not defined [closed]

i got this error form my custom module , here is my little code in progress-bar.tpl.php: <body> <!-- Static navbar --> <div class="navbar navbar-inverse"> <div ...
1
vote
2answers
21 views

Add conditional javascript from CDN (external library)

I know it has been discussed here several times, but: Is there a way to include conditional JS from CDN in the head section? My goal is to somehow use drupal_add_js, external. That will stick in the ...
0
votes
1answer
15 views

How can I remove javascript from everywhere but the front page?

I tried using this in template.php function MYTHEME_js_alter(&$javascript) { if ($!is_front) { unset($javascript['path/to/script.js']); } } but it doesn't work. Performance wise, would ...
0
votes
0answers
18 views

Script injected into varibale table?

In search for delays in page rendering have noticed some "script" that seems to be injected to rendered templates, and caused a lot of delays: ...
0
votes
0answers
9 views

I have a problem with LazyLoader script tag that is placed before jquery?

LazyLoader gives the error on my page in FireBug and does not work. My variable $scripts in my theme is before as google page insight recommends. but lazyloader paste the firstest script that does ...
1
vote
0answers
15 views

Warn user before leaving web page with unsaved changes [duplicate]

I have some pages with forms in my application. How can I secure the form in such a way that if someone navigates away or closes the browser tab, they should be prompted to to confirm they really ...
0
votes
1answer
15 views

How can I make web scraping of a field more difficult?

I have a text field that I get with <?php print render ($content['field'][0]['#markup']); ?> in node.tpl. I'd like to somehow make loading the markup require a click, and deselecting it to put ...
0
votes
0answers
17 views

WYSIWYG CKeditor ignore height (rows) when displayed into vertical tab

When CKeditor (I use the WYSIWYG module) is included into vertical tab (not the firstly visible tab) the height size is calculated from the container (tab) and ignore the rows attributes from the ...
2
votes
2answers
237 views

How to add JavaScript code to a webform?

I want to add JavaScript code to a webform. For example, to add things like onclick, onchange, mouseover function to webform's textbox, textarea, select, email, etc. How do I do so?
0
votes
2answers
59 views

How to call a javascript function?

I have included in my theme a new javascript library(Easy-Responsive-Tabs-to-Accordion) which converts horizontal tabs to accordion. So I have included in my .info theme scripts[] = ...
0
votes
0answers
24 views

Drupal absolutely refuses to serve gzip css and js files, however they are produced just fine. What could be causing this?

What I have tried so far: All variations of modifications and additions to .htaccess gzip relevant sections near the bottom. The Advanced CSS/JS Aggregation module, and all suggested configurations ...