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
votes
2answers
13 views

a little javascript help

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", ...
0
votes
0answers
10 views

IE File field 'change' event issue [on hold]

When I try to track change event of file field in IE is not working. What I did is: $(document).ready(function(){ $('#browse').click(function(){ $('#file').click(); }); ...
-1
votes
1answer
23 views

Javascript closures in modules [on hold]

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
17 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() . ...
1
vote
0answers
17 views
+50

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
22 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 ...
1
vote
0answers
21 views

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
25 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
19 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
14 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
23 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
26 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
22 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
36 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
0answers
58 views

Embed OOKLA SPEEDTEST MINI script

I'm trying to embed OOKLA SPEEDTEST MINI script into a drupal basic page, I put the speedtest folder in sites/all/libraries and the speedtest.swf in sites/all/libraries/speedtest folder, I gived the ...
-2
votes
1answer
46 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
13 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
13 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
53 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
22 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
27 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
33 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
34 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
22 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
25 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 ...
0
votes
1answer
31 views

Use drupal.settings variables on javascript

I think this is a silly question, but I can't seem to find the "right" keyword to use in searching the forums. Anyway I'm using the google maps API on my website regarding restaurants. The map loads ...
0
votes
1answer
40 views

How to add special character validation on specific field in form registration process

I want to add a special character validation on a specfic field. Here I have my code but it does not work and there is no error. function mymodule_form_alter(&$form, &$form_state, ...
0
votes
1answer
82 views

Have Leaflet marker popup open on page load

Has anyone used Leaflet to display a single location, while making the "popup" open when the map is loaded? This is really easy to do in Leaflet, but the module's JS is a little hard to decipher. ...
0
votes
1answer
15 views

Question about Managing JavaScript in Drupal 7

If you go to https://www.drupal.org/node/756722#behaviors at Behaviors section you will see: (function ($) { Drupal.behaviors.exampleModule = { attach: function (context, settings) { ...
2
votes
1answer
51 views

Add a small javascript/HTML to a page

So I have a small bit of HTML and Javascript that I want to embed in a basic page. I go to edit the page, turn off rich text editing, and paste the HTML/javascript. I save, and then the javascript ...
-1
votes
1answer
21 views

I have Created a form to upload images, where i should display error message if i upload more than 3 images and should disable submit button

I have Created a form to upload images, where i should display error message if i upload more than 3 images and should disable submit button to delete already uploaded image if i want to upload more ...
1
vote
1answer
24 views

D7 - Syntax of js custom file added directly to theme

Alright, so I've read the documentation of JS framework in Drupal and there is a simple example how the syntax of JS file should look: Drupal.behaviors.myModuleBehavior = { attach: function ...
0
votes
0answers
15 views

hook_form_alter logic only on certain buttons

I have an existing webform that I'm using hook_form_alter to prepopulate various fields on. It "worked" before I just added a new field. I just added a new Upload File field (a Managed file I believe ...
0
votes
1answer
61 views

Drupalgap exposed filter for data and select field

I spent all weekend trying to make this work, and couldn't figure it out. How do I create a views exposed filter for date and a text list on a given node? My setup - I have a view that is exposed as ...
0
votes
2answers
44 views

How to block users to accessing Drupal website if javascript is not enabled?

I checked many pages in Drupal Answers, which didn't have the answer of the following question: Consider a case that I need javascript to be enabled for visual effects in drupal design. How can I ...
2
votes
2answers
62 views

How to make a reset form button without type 'markup'?

My situation: I built a form with FAPI. I display the results in a table like this: function grap_contact_repository_form_submit($form, &$form_state) { ... $form_state['results_table'] = ...
3
votes
2answers
117 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
170 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
1answer
34 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
1answer
40 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
vote
2answers
54 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 ...
1
vote
1answer
48 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
49 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
70 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
52 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
31 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
45 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
21 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
10 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
151 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 ...