Questions tagged [javascript]

637878 questions
1

votes
2

answer
760

Views

Chartjs - Add backgroundColor for labels radar chart

>>> Radar chart labels with background color Hi there, I just want to ask for an option to add the background color (a rounded rect with bg color) for labels (individually) in Chartjs. Is there any callback that I can apply for changing this, any help is appreciated with best regards! This is the cu...
spideyinf
1

votes
1

answer
61

Views

How the sender can see its own messages too with socket.io?

I'm using socket.io and I want to send a message to a specific user by its socket.id and that the sender will see its own message too. I get the socket.id and sending the message by: socket.to(msg.id).emit('chat message', msg.message); which msg.id is the socket.id of the recipient. I found out tha...
zb22
1

votes
3

answer
142

Views

Find a tangent between line segment and circle

I have a line segment A (x1, y1), B (x2, y2) and a circle with the center C (x3, y3). Also I have radius of the circle. How do I get tangents? These tangent lines should always be parallel to line segment. P.S. Sorry if it is doesn't make sense to you, I am very very bad at math. Ask me any questi...
boshetoonmai
1

votes
0

answer
249

Views

Krajee's file input only upload last selected image

I'm working with this plugin in Codeigniter as I want to upload multiple files (either it can be multiple images, videos or files) and as mentioned there I have done the following code HTML Script $('#attachment').fileinput({ uploadUrl: '#', uploadAsync: false, showCaption: false, fileActionSettings...
Mr. Pyramid
1

votes
1

answer
48

Views

How to acquire the object ID?

I want to dynamically create images to a screen, but later when I touch them, I would like to get the object ID which I touch, in order to delete or manipulate it. I am posting the code which I am dynamically creating the images. Any help on how to acquire the images(object) ID? this.i = this.i + 1...
PetePan
1

votes
1

answer
45

Views

How to keep pie menu in background?

I have an page layout which cover all components const PageLayout = ({ children, navBar }) => { return ( {children} © 2017. {settings.app.name}. ); }; And each page have prototype look like this class SecuritySystemPage extends Component { render() { return ( {//some thing to display here} ) } } Re...
tuan.tran
1

votes
0

answer
51

Views

How to trigger css keyframe with Scrollmagic?

I'm looking for example to trigger CSS keyframe with Scrollmagic but I couldn't find it. Basically I need JavaScript code to trigger this keyframe with scrollmagic. .project-title-line { width: 264px; height: 4px; margin-top: 10px; background-color: rgba(235, 235, 235, 0.4); border: 0; display: bloc...
zee7
1

votes
0

answer
52

Views

How to check if FontFace prototype exists in Edge

I am using FontFace to preload fonts, it's working ok on chrome, but it stops page in Edge because FontFace is not defined in Edge. How can I check if FontFace class prototype exists ( in JavaScript) so I don't construct it in Edge? (I know FontFace prototype doesn't exist in Edge, but just wanted t...
AVEbrahimi
1

votes
2

answer
407

Views

toLocaleString() not working no errors showing up

I'm trying to add commas to the input to both the value integers and the summary number in the middle. I've added $summaryNumber.toLocaleString(); but nothing works. I'm trying to understand what I'm doing wrong. here's a fiddle with what I'm working with https://jsfiddle.net/cmLkbq6e/2/ $(function(...
larry burns
1

votes
1

answer
59

Views

Send data to another JavaScript file from a JavaScript file

I want to see the information of this admin in the panel when admin enters the panel. But there are more than one admin on the system. Therefore, I need to find the administrator who logs in to the system according to the mail entered from the login page. When I click submit button, I need to send t...
Engr. Arda
1

votes
0

answer
44

Views

FlexSlider images will not load on tabs

I have 2 sliders in one page without tabs they are working properly. Check my screenshot below but when I try to apply tab-pane my second slider not showing Looks like this But when my minimize then maximize the page it will show. Here's my code below HTML {lang_media_slider} {lang_media_plans}...
Carlvic Lim
1

votes
1

answer
49

Views

Carousel's image is bigger I expected

Carousel's image is bigger I expected. My Code * { margin: 0; padding: 0; } .menu { background-color: gray; width: 500px; height: 100%; float: left; } .title { color: white; font-size: 30px; margin: 0px 5px; margin-left: 40px; text-align: center; } .first { padding-top: 30px; } h...
user8817674
1

votes
0

answer
88

Views

How do I get rid of BSON objects after a mapReduce?

I'm a complete beginner to map-reduce and relatively new with MongoDB. I am trying to perform a map-reduce on a collection (by the name Customers). My map function: var map = function() { emit(this.nationality, {edad: this.age, telefono: this.phone_number}); }; My reduce function: var reduce = funct...
1

votes
1

answer
58

Views

Adding barchart into tooltip of scatterChart in nvd3 - react component not rendering

I created a scatterChart from nvd3 and then tried to customize the tooltip the way it is described here: nvd3 piechart.js - How to edit the tooltip? using chart.tooltip.contentGenerator() approach: import React from 'react' import * as d3 from 'd3'; import nvd3 from 'nvd3'; var nv = nvd3; import Bar...
Nikita Vlasenko
1

votes
1

answer
102

Views

Read large (1G) binary file as it loads in Javascript [duplicate]

This question already has an answer here: filereader api on big files 2 answers I have always fully loaded binary files and then gone on to scan the content blocks within. This was fine for anything up to say 500K. I'm now looking at scanning files that are as large as 1G or higher. (Client side) L...
ChipAhoy
1

votes
1

answer
109

Views

HTML5 Canvas - Scrolling a map (made with a 2 dimensional array) using setTransform

I'm making a 2D platformer with HTML5 Canvas. I have a map that's made using a 2 dimensional array. Ex: var map = [ [0,0,0], [0,0,0], [0,0,0] ]; When the player moves, it updates the camera's position, and the map is scrolled accordingly (the camera dimensions are the same as the canvas, 800 by 500...
Jordan
1

votes
4

answer
67

Views

What is the best way to print all the dates contained on some objects dates ranges inside an array?

If I have an array of objects like this: { 'workPeriods': [ { 'user_id': '9345bf', 'startDate': '2018-02-05T05:00:00.000Z', 'endDate': '2018-02-09T05:00:00.000Z' }, { 'user_id': '80c3a9', 'startDate': '2018-02-12T05:00:00.000Z', 'endDate': '2018-02-16T05:00:00.000Z' }, { 'user_id': '35jh87', 'startD...
Leonardo Uribe
1

votes
0

answer
262

Views

Prevent Middle Click button from opening new tab in FIREFOX not working

I have the following simple code -I had a rather more sophisticated thing but this exemplifies my point-. I have the below html Click me And the following javascript code function preventOpen(event, element){ event = event || window.event; event.preventDefault(); if (event.which != 3) { element.clic...
user2237998
1

votes
1

answer
228

Views

Reading text file with special characters using d3.request

I have a file.txt that I need to get to my script and parse via d3.request. The content of file is encoded with windows-1250 encoding and has extra lines to be deleted, so that only lines starting with 'Date' and '2017' should pass. So far I have been using cli solution to grep text file (removing e...
mtx
1

votes
2

answer
53

Views

Passing Python variable to Javascript with Webapp2/Jinja2

I've researched this answer and haven't found a way to do this using webapp2. I need to pass a variable from my Python code into my Javascript code. I understand how to pass variables into my HTML using Jinja2 but I am stumped on how they can then be used in Javascript. This is what I have put in th...
user9109814
1

votes
0

answer
143

Views

How to design a line deleting function for Tetris game?

I am trying to build a Tetris game in javaScript and HTML. I ran into problems with my function for removing the full lines. It sort of works, but not every time and not as I expected. I am not a professional programmer, I am learning to code just for fun. My knowledge of javaScript is limited and m...
Radek John
1

votes
2

answer
62

Views

add/removeClass doesn`t work on iPhone

This works correctly on browser but doesn't work on iPhone. Also I used the var $event = ($ua.match(/(iPod|iPhone|iPad)/i)) ? 'touchstart' : 'click'; It also doesn`t work on iPhone HTML hello CSS .mod_section.active{ display:none; } .mod_section{ display:block; } JQuery function mod(){ $('.mod_secti...
Eric Lee
1

votes
0

answer
48

Views

how to set default view using angular-route-segment (not in index.html) angular js

In my MEAN application for nested views I am using angular-route-segment. Everything works fine with the nested views except for the initial default screen. my first page (index.html) contains header & footer with buttons connect & disconnect. This theme is common in all the pages. once I click conn...
Krishna Kiriti
1

votes
1

answer
490

Views

ScrollTop goes to the wrong top

I have a list of items. When I click on one item (project) it opens (this is ok) and it scrolls to the top of the page (the wrong top!). The problem occurs when I have an opened item and I decide to open the one below: the top position is increased by the opened project height and the second project...
Lorenzo Toso
1

votes
1

answer
170

Views

Changing an inspect element with selenium java/JavaScript console?

I'm trying to use the selenium chrome driver on Java and part of my script requires me to edit a google chrome element of a website. How can I modify the value of this element using java? I figured out I'm supposed to use this code: JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScri...
Blake W
1

votes
0

answer
622

Views

Cannot read property 'DataTable' of undefined in google charts

as the title saying im getting this error when trying to get charts inside function in another file like this functions.php function get_likes($catid){ require dirname (__FILE__).'/dbfunction.php'; ?> google.charts.load('current', {'packages':['corechart']}); a= ; b= ; c= ; i= ; ///// this i is...
Samir Daraf
1

votes
0

answer
512

Views

I get a 503 response status whenever I try to make a POST request from my client

I recently created a server and deployed it to Heroku. It works fine in Postman and when testing out basic GET requests. But whenever I try to make POST request to it via Axios in my client, I am met with this error. In my back-end server, I enabled cors so that it could make cross-domain requests....
MountainSlayer
1

votes
0

answer
301

Views

Bootstrap modal, strange behavior (duplicate informations)

I'm using Laravel 5.5, Bootstrap 3.7 and jQuery. When I open the modal and close it directly, then when I do an action in the modal it performs two times the opening function. If I open and close it (directly) three times, then when I do an action in the modal it performs four times the opening func...
N. Lamblin
1

votes
1

answer
38

Views

Remove inline javascript in jsp foreach

I currently have a jsp page like the following: Submit form with default Submit form for detail id function myFunction1() { document.myForm.id.value = 0; document.myForm.submit(); } function myFunction2(detailId) { document.myForm.id.value = detailId; document.myForm.submit(); } For security reason...
Dale
1

votes
2

answer
78

Views

Passing data from child to parent in React shows type error

I am new in React Js I am trying to pass value from child to parent and while showing components through a map there shows an error in the emit/trigger function render(){ var choices =['krass', 'Einfach', 'Dazu', 'Dafur']; const listitem = choices.map(function(name, index){ ; }); return ( {listitem...
Md. Jahidul Islam
1

votes
1

answer
105

Views

How to use setActiveItem for card layout to display a panel based on radiobuttton selection?

var radioGroup = { xtype: 'radiogroup', itemId: 'radioButton', layout: 'hbox', width: 700, defaults: { flex: 1 }, items: [{ boxLabel: option1 name: 'timeInterval', inputValue:0 checked: true }, { boxLabel: option2 name: 'timeInterval', inputValue:1, checked: false }, { boxLabel: option1 name: 'timeI...
buddy
1

votes
1

answer
50

Views

Track conversions of HubSpot Landing page while using 3rd party Form

My company has been using HubSpot for leads and registrations. We recently integrated HubSpot with Salesforce and the integration has caused issues due to HubSpot deduping. Many of our customers are employees of hotels who move around to different hotels or work for multiple hotels at the same time,...
Travis Little
1

votes
0

answer
309

Views

“include” js and css file using a RELATIVE path from js file

Using Symfony 2.8.24 and jQuery 3.2.1 Been googling for this for a while now and, yes, there are lots of similar cases, involving using relative paths for resource loading but, none I have found which explains what I need, so SO: I need to include (or load or append to head or something) a css file...
Scaramouche
1

votes
1

answer
92

Views

Divide gulp-file into several files

I want to divide one big gulp-file into several files. Some of this files is supposed to contain gulp-tasks, others – raw functions, third files – both. How can I do it? I've tried to create directory with a few files, some like that: gulpfile.js gulp/ ├── css_tasks.js └── js_tasks.j...
1

votes
1

answer
46

Views

How can I get ID from “ul” dynamic tag

I have the next situation. I have a button in HTML code. When I press one of the options from the button I call a function that constructs the content from other button. I have a ul tag in HTML code with a list of li tags inside. The value of this li tags are generated dynamically with a query datab...
olga fm
1

votes
2

answer
432

Views

React Router Link with params not reloading page with new data from componentDidMount and Redux axios data fetching

I have this react + redux app I have 1 Movie component with some movie data displayed on it which are fetched from API. So at the bottom, i decided to add a Similar movies section with a couple of components to navigate to the new movie pages. { this.props.thisMovieIdDataSIMILAR.slice(0,4).map((mov...
1

votes
1

answer
295

Views

Access nested object key by variable

Let's say I have an array of objects like here: const myArray = [{ name: 'FirstObj', things: { firstThing: 'something', secondThing: 'anotherThing' } }, { name: 'OtherObjWithVeryLongName', things: { firstThing: 'something', secondThing: 'anotherThing' } }] I need to access .length property of proper...
Przemek
1

votes
0

answer
21

Views

How Do I Test Just The Functions Of My React Native Component?

I have the following component... import React, {Component} from 'react'; import {connect} from 'react-redux'; import { Button, StyleSheet, Text, View, TextInput } from 'react-native'; import BooksViewModel from './books-viewmodel' class BooksComponent extends Component { constructor(props) { debugg...
Exitos
1

votes
0

answer
219

Views

I can't reinstall or update Electron package

Microsoft Windows [Version 10.0.16299.125] (c) 2017 Microsoft Corporation. All rights reserved. D:\nodejs projects\New>npm update electron [email protected] postinstall D:\nodejs projects\New\node_modules\electron node install.js I have this error when I start the project: Error: Electron failed to ins...
Zoubair Daddow
1

votes
1

answer
71

Views

Retrieve multiple rowids in SQLite insert or update, using JavaScript

I know SQLite have last_insert_rowid() function. I'd like to create a similar function but I want to retrieve an array of indexes, each one coming from an insert or update into my db. To be clearer, I have a populated table like this (name is UNIQUE): rowid name age 1 'John' 18 2 'Anne'...
Zappescu

View additional questions