Questions tagged [javascript]

639396 questions
1

votes
3

answer
2.6k

Views

Uncaught TypeError: $(…).code is not a function (Summernote)

I don't know if it's the same error as many got here: jQuery is not a function erreor how to fix : Uncaught TypeError: $(...).summernote is not a function #2087 jquery: Uncaught TypeError: $(…).error is not a function But I'm stuck with it like a gum under my shoe. Here's the actual error on my Ch...
Will Marcouiller
1

votes
1

answer
825

Views

Best practice for updating individual state properties with Redux Saga

So I'm working on implementing an application in React with Redux Saga and I'm kind of baffled at how little information there is out there for my particular use case, as it doesn't seem that strange. Quite possibly I am using the wrong terms or thinking about the problem in the wrong way, as I am r...
rosalindwills
1

votes
3

answer
1.1k

Views

react native how to get return from a promise

my problem is i want to get a json from this function but all i get is a only a promise and why i choose this way because in app that i'm working on it works dynamicly but the only place that i see i can put this promise is render() this is my code : var userInfo = (async()=>{ var value = await Asy...
shahabvshahabi
1

votes
1

answer
503

Views

Function from other file is not defined

I wrap by $(function) both files for running code when page is ready. But for some reasons calling function from first file in second file gives me error 'ReferenceError: test is not defined'. First file: $(function() { function test() { alert(1); } }); Second file: $(function() { test(); });
DIAMONDMAN
1

votes
1

answer
2.2k

Views

Problems with async code in Jest tests

I am having problem with getting the code into the beforeAll function finish and wait for the promise that resolves the storyLinks. The console log at the end of the snippet returns undefined but I need it to return the hrefs of the stories in my storybook. I cannot wrap this into an async function...
Ruxandra Anghel
1

votes
1

answer
3.5k

Views

Webpack: You may need an appropriate loader to handle this file

I am setting up typescript with webpack, using awesome-typescript-loader. However webpack is giving me this error on build: ERROR in ./src/logic/Something.ts Module parse failed: Unexpected token (2:19) You may need an appropriate loader to handle this file type. here is a piece of code from webpac...
Martin Shishkov
1

votes
1

answer
84

Views

Reference js file using webpack

I am new to webpack, and am using it to compile my Elm project. I have the following configuration file var path = require('path'); module.exports = { entry: { app: [ './src/index.js' ] }, output: { path: path.resolve(__dirname + '/dist'), filename: '[name].js', }, module: { rules: [ { test: /\.(cs...
Murdock
1

votes
2

answer
1.5k

Views

Difference between destructing export default and module.exports

I've been struggling to destruct my mongo object in another file, my object structure is like below. const env = { project: 'CRIBBBLE BACKEND', url: 'localhost', api: { url: 'https://api.dribbble.com/v1/', }, port: parseInt(process.env.PORT, 10) || 3000, mongo: database, }; export default env; But w...
Pedram marandi
1

votes
2

answer
2.3k

Views

How to add parameters to a GET request in node.js?

I am trying to access the different information from the following api:https://api.coinnest.co.kr/doc/public.html and stumped in trying to get data for all the different parameters for the /api/pub/ticker request Here is the code I have written so far, but i cant seem to get any different info for d...
WasabiCannon
1

votes
1

answer
641

Views

ES6 export an existing object

How come I can write export { function1, function2 }; But I can't write const funcs = { function1, function2 }; export funcs; Isn't it semantically the same thing? Is there any way to export all properties from an object without listing them all one by one? I want to be able to import the module as...
riv
1

votes
1

answer
624

Views

How can I unit test a custom element

I have a class that extends HTMLElement. From reading this thread https://github.com/Microsoft/TypeScript/issues/574#issuecomment-231683089 I see that I can't instantiate a custom element with out getting a Illegal constructor. Additionally, the registerElement looked promising as it returned the...
Jonathan Fishbein
0

votes
1

answer
35

Views

Calling JavaScript function from another page

I am having an issue calling form() from my dropdown. When I check the source, it shows the assist/form.js is being seen from the web-page. I have copied and paste the form() the from page to the main page. Here is an example of my Code. main page: assist/form page: function form(type) {...} Error I...
user8776656
0

votes
4

answer
71

Views

How can I use this in a loop?

I'm doing this for a class assignment and I know there has to be a better way of writing it. Maybe some kind of loop that gets the inputs and labels? I'm repeating a lot here and it seems better to minify this if possible. function checkEmptyFields() { if(formName.value === '') { formLabels[...
Loodie
-1

votes
1

answer
39

Views

Excluding Sunday and Saturday in Javascript

My js project is working fine but I need to exclude Saturdays and Sunday in it, or even holiday. Can you please check on my code on how can I achieve this. Meet me at var m_names = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'Decemb...
Jhon Geric
-1

votes
0

answer
28

Views

How do I disable a function with another function in javascript, and vice versa? [on hold]

I want a function to be able to disable another function and to enable back a function. function myMove() { var id = setInterval(frame, 1); function frame() { if (pos == slutpos) { clearInterval(id); slutpos+=100; } else { pos++; karusellEl.style.marginLeft = pos + 'px'; } } if(pos>200) { //...
Krøsh
-1

votes
0

answer
26

Views

Generate download using javascript [duplicate]

This question already has an answer here: download file using an ajax request 9 answers How do I return the response from an asynchronous call? 34 answers I'm trying to make a downloadeable file. Since it takes a while to generate I wanna use jQuery to show an animation and then download the file...
ffuentes
0

votes
0

answer
28

Views

Video-streaming the content of a div

I'm developing a teaching application and I would like to be able to stream the contents of a div (the div will contain pictures, text, a white board emulator, etc used during the lesson). The teacher should be able to switch from the regular webcam to the div when necessary. Is there any way to ach...
devamat
0

votes
1

answer
22

Views

How to convert a Java Hashmap to a javascript array properly

I want to convert a Java HashMap to a javascript array where the key is inside the javascript object. I have tried to convert the JSON to a javascript object with an array inside. The Java Map looks like this < string: 'sequence', Object: Round> A quick overview of the objects I want to convert fr...
Stefan Gies
0

votes
0

answer
20

Views

How to test if relative url works in JavaScript?

This may be a pretty basic or stupid question, but I couldn't find the answer online so... Im using this relative url in JavaScript to add a div with an image. The relative url goes to the path of the image. I'm not seeing an image and I don't know if that is because the relative url is wrong or som...
Daan Proost
0

votes
0

answer
20

Views

Is there a method similar to lag (in R) or shift (in Python) for the javascript framework data-forge?

I have a code like this: const dataForge = require('data-forge'); var df = new dataForge.DataFrame({columns: {col1: [1,2,3,4,5]}}); console.log(df.toString()); with this result: __index__ col1 --------- ---- 0 1 1 2 2 3 3 4 4 5 in R and in Python like n...
EFA
0

votes
0

answer
18

Views

Getting POST API to work with ajax using JavaScript

I'm trying to reach an API from inside my tag manager. The language to use for the so-called building blocks in this tag-manager is JavaScript. The POST API I am trying to use is fully functioning and works like this: input: {'features': 'xyz'} output: [0.45] I set up an ajax statement, but it does...
T.Beil
0

votes
1

answer
20

Views

How to avoid sending multiple duplicate AJAX requests in axios

Is it possible to automatically throttle all requests going to a particular list of endpoints using axios? Perhaps using axios interceptor? Currently I throttle the user action that sends the axios request, but the problem with that is that I have to write this everywhere I have a user action that r...
ManavM
0

votes
0

answer
18

Views

How do i update the total price and retain the new quantity after i update

I am creating a shopping cart, and I want the total price to be updated when I click on the update button. Also, I want the new quantity and total price to remain the same after I refresh the page. I'm using the wamp server. This is the display code: function showItem(){ var total=0; for(var i in sh...
Godosn
0

votes
1

answer
17

Views

onClick event on element on Mobile device hover state is still applied

I can't seem to find anyone with this same issue online with React, unless I've been searching for the wrong thing? I have a button (anchor tag) that has an onClick event. When the onClick event is triggered it calls a loadMore() function that makes an API call and updates some state. However on a m...
mcclosa
0

votes
0

answer
17

Views

Why is iOS not showing keyboard for input after js has unset a readonly tag?

I have a text field in HTML form set to readonly. Upon entry javascript should test if the field is currently being edited by someone else, if not the readonly will be set to false and editing of that field is allowed. For this I have used the onFocus() event. This works fine in Chrome and Firefox b...
2x2p
0

votes
0

answer
17

Views

What does this String.fromCharcode and charCodeAt particularly do

Basically, I am not able to understand this part from a code which is making a XOR cypher using javascript. cipherd += String.fromCharCode(enckey ^ plainstring.charCodeAt(i));
0

votes
1

answer
16

Views

setCustomValidity() not working in Chrome browser

I've got a problem when I'm trying to set custom message in my input: It's working on Firefox browser but on Chrome oninvalid is ignored and it still displays custom message. I've found one topic about version of Chrome HERE, but I have version 74. It's possible they still have not fixed it?
Marshall
0

votes
0

answer
18

Views

Dynamic Header works just on index.html

I'm building a website that's having a header with a function(if I scroll down it makes the header smaller). Problem is that on index.html it works properly but on my second-page in,t working. And to create the second page I just copied the first page and added some extra content. Does anyone know w...
DConstantin
2

votes
1

answer
110

Views

Trying to make epaper dynamic using C# asp.net web form

I have static e paper but i want to develop dynamic e-paper like below url https://epaper.dawn.com/?page=15_04_2019_001 I have no idea to start e paper dynamic below is my whole html code q Times body { background-color: #fafafa; min-height: 100vh;} .container { margin: 200px auto; max-width: 600px;...
mohd mazhar khan
5

votes
0

answer
90

Views

How to decode Data (ie block state) bytes in Minecraft schematic (nbt) file?

I am parsing a schematic file with the following structure The .schematic file format was created by the community to store sections of a Minecraft world for use with third-party programs. Schematics are in NBT format The Named Binary Tag (NBT) file format is an extremely simple structured binary f...
lancew
0

votes
0

answer
4

Views

Getting DOMException with playing video onload

I want to play a video when the website is loaded. For that I am using the following code: window.onload = function webisteLoaded() { var main_bg_video = document.getElementById('main_bg_video'); main_bg_video.play(); } Your browser does not support HTML5 video. Additional info: I import the s...
Filip Degenhart
0

votes
1

answer
7

Views

One out of two Document property not inserted in a mongoDB collection using: Mongoose and ExpressJS

A Nodejs server application gets Name and Age from an HTML form (with post method) and with the help of ExpressJS and Mongoose has to create a MongoDB document. That works but Age is not written in the document of the collection. Please help me to fix it. Here are the files with the code: personform...
user374324
0

votes
0

answer
9

Views

Blogspot post content : How to get second image src using javascript

I'm working on a blogspot template and I need to get the second image from post content I've tried: var postcontent = entry.content.$t; var images = postcontent.getElementsByTagName('img'); document.write(images[1]);
wiseman
1

votes
1

answer
14

Views

How do I add an offset to a scroll detection function?

I'm having some trouble adding in an option offset to my JS code. I wish to be able to add an offset on when the code initiates on the screen, but can't seem to figure out where I would put the calculation. I have tried minusing the offset from window.innerHeight but it seems to cause the opposite...
Kapur32
0

votes
0

answer
4

Views

saving csv file to server - seems to have (squares) limitation on saving

I'm saving data to my server using a CSV format (writing in javascript and html). and it seems that the server stops to write into the file after 1000 squares, while the number of rows\chars is not relevant (the file size is not the issue). the exact same code works for me just fine on a different s...
vill
1

votes
0

answer
20

Views

Is there a better way to call and place this click handler function?

I have a draw function whose purpose is to provide elements' movements and interactivity. In this function, I place an Event Listener for clicks. How is supposed to work this Event Listener? When pushed, the event listener gets the x and y values of the point where it was clicked, and, the elements...
Toledo
0

votes
0

answer
4

Views

Display alert message using Form Script in Netsuite OpenAir in Project record

I have written a 'Form script' for Project record in Netsuite-OpenAir. I would like to display an alert message on clicking on the 'Save' button in Project record. The code that I have currently written in the form script is: NSOA.meta.alert('Form Alert Message'); But it seems that this alert messa...
Anand Rajaram
1

votes
0

answer
6

Views

Composable and positive contracts in Flow

I'm having a problem with Flow where a given implemented type is restricting my object API by asking me to use only properties that are declared on the type instead of asking me to declare all the type's properties. I'm new to Flow so I'm probably making some basic mistake and stuff. Anyway, I have...
Henrique Guerra
0

votes
0

answer
2

Views

Trying to show a map using the Google Places API, but it is not displayed due to the following error: initMap is not a function

I am trying to load a map on my WordPress apage using the Google Places API. However, it does not display, which is probably due to the following error: 'initMap is not a function'. I found several related threats, but I couldn't find the right answer that applies to my specific case: jQuery(documen...
user3588669
1

votes
0

answer
8

Views

React named presentational / container parent / child components breakdown

Okay, I am trying to make a project using container / presentational components design but I am missing some kind of information or knowledege. What I am trying to do is to render a component based upon it's parent component's type: I have this route: http://localhost:3000/:componentId componentId h...
Martin Fernandez

View additional questions