Javascript Tutorials
Ad
JavaScript object how to use Foreach loop
JavaScript's Array#forEach() function lets you iterate over an array, but not over an object. You can iterate over a JavaScript object using forEach() using Object.keys(), Object.values(), or Object.entries().
MapboxGL is not defined error solution
Fix mapboxgl is not defined. it's an easy fix you just have to include mepboxgl script into your Head section.
Mapbox production error in console Uncaught Reference Error
Fix Mapbox production error in console. "Uncaught ReferenceError: y is not defined". with Mapbox 2.0 version React app in the production environment gets this error and it's really easy to fix it.
Essential javascript array functions
Much more efficient and flexible Essential javascript array functions to use in daily routine. Great Power at no performance cost.
Javascript Questions
How to get response from firebase after set?
Function creategame(gameid, pin, currentdatetime, playername) { firebase.database().ref('games/' + gameid).set({ pin: pin,
HEROKU Error: ENOENT: no such file or directory, stat '/app/distpublic/index.html'
I know there are alot of questions like this on the site but i ihave tried everything i could on this site, the best i could get to work on heroku
Heroku Error: ENOENT: no such file or directory, open '.env'
I'm trying to push my application to heroku, but i'm running into some issues: error: enoent: no such file or directory,
"Failed to execute 'querySelector' on 'Document': 'class MyComponent extends HTMLElement" during Karma test
I am getting the error mentioned in this question head. i don't understand why i can't check if certain div id is available. it is quite simple
Cannot assign to 'MyComponent' because it is not a variable (react-dnd multi drag&drop support in ReactJS
I would like to have drag and drop at the same time using react-dnd // ... imports ... class mycomponent extends
Trouble adding onclick handler to hyperlink tag inside listitem
Trying to add an onclick handler to my tabs, and can't seem to get the dom selection right. can you guys help? <div
Do I need to keep bootstrap.js in Laravel?
When i created my laravel project, there's a file called bootstrap.js in resources/js. i'm not using vue or any js
Module not found: can't resolve 'moduleName' in react js
While learning react js from official documentation
What is the meaning of the square brackets in “.module("modulename", […])” of AngularJS
I just saw an example of routing in angularjs. i would
Ad
Ember 1.12 Cannot read property 'moduleName' of undefined
I updated my ember version from 1.11 to 1.12 and now i'm getting this error message on console when trying to run the app:
Getting only one <modulename>.nocache.js file in Multiple Entry Point Module
My project structure has two entry point methods on client side in extrygate.java exitgate.java i have also
prototype methods do not visible in constructor if module load with require('moduleName')
I have a simple module, it's code var router = function(pattern) { this.setroutepattern(pattern); };
React Navigation V4: Swipe on drawer does not work in Android
I have been searching for a solution for a long time but in react navigation v4 there is no answer i have created a simple drawer
React - componentDidUpdate() is unable to find DOM objects rendered by the render() method
Edit: i've edited the code to add and use refs instead of document.getelementbyid. it didn't fix the problem.
To show/hide a Form.control based on check/uncheck from Form.check in react bootstrap
I am pretty new to react and bootstrap. i want to know - how can i control the visibility of a form.control when form.check is checked or
Method “simulate” is only meant to be run on a single node. 0 found instead
I am learning enzyme with react but i am facing this problem can any one help me out . i am trying to test register page on change username and
Slider API of Material is not render the slider properly in case of fraction number as step, marks | material ui | Slider | React
I have a react application on which i am going to add the material ui slider. but i can't able to create the slider properly. i don't know which
Access constructor variables inside the render method - Reactjs
I have a simple registration form as shown in the below code and is aiming to do display my validation message on submit. the code is mostly in
How to convert string hours to 'hh:mm:ss' format?
I'm getting my google api response for duration like 1 hour 13 minutes i need to covert this to 'hh:mm:ss' format.how to convert this
Javascript deep copy without breaking dates
I would like to make a deep copy (break references) without turning date objects into strings, how would i do that?
Ad
async/await: wait for loop end before return function result
I have next function: async getpopular() { return await
Weird behavior in displaying textContent when there's overflow
I am making a calculator app and there i am noticing a weird glitch. when i enter "1-1111...." and the moment it overflows the
How to remove # from URL and 404 reload issue in angular build and nodejs application?
I have angular9 and nodejs application. i am doing ng build --prod for production build and putting that build file inside nodejs
Call function after event is called from bootrap file
Theres a modal that open on click of some div .i want to extent the close or mouseout event of this modal(which is defined in bootrap.min.js).by
Required props undefined in chrome 83
So after installing chrome 83 one of my pages in my app crashes. it says some of my props that's required is undefined. this only happens in
How to Slice character and display in HTML file in Angular 8
I have below string which i am displaying in html file from api response. for ex - test,abc,red,blue,green
Asp.Net core MVC Javascript Ajax parameters null HttpPost
I am writing a javascript function for a button <button type="button" class="btn btn-sm btn-outline-secondary"
text file to arraylist javascript
I have a txt file on mydomain.net/file.txt.how can i read this into an array filecontent where each new line is a
How to edit style of negative x grid lines on Chart.js?
I want to draw dashed lines on the x-axis for the negative value on my chart, how i can do that?
How to find index of an array that contains specific array in it?
I'm developing a ecommerce cart, in the following cart each item could have some "variants", the item model looks like the following where
Angular not setting correct form validation classes in tests
There seems to be an issue with angular applying validation classes in unit test environment. by validation classes i mean ng-valid
Ad
I get error when sending data using express from node server to client side JavaScript
I am making a post call from ajax to node server. server makes the call and gives the response. but also below error displays in the cmd
How to delay a button display to 2s in Vuejs
I have a button component which i am using in several places. but i want to show that button after 2s on a specific page. how can i achieve this
How can I loop for multiple classes in jQuery?
I want to make a loop instead of adding javascript for each element to show the div on first click and hide the div on second click. only
How to remove cache after a new build react project
When we have a new build in our react project, users who work with our pwa because they have old cache they cant have our last changes and they
Should I use onclick or click method inside jQuerys document ready?
I don't know if i should use onclick in html/php or a single click function bound to a specific id. onclick example:
Why are all my child components re-rendering despite having keys?
I was playing around with react-dev-tools chrome extension and found out that all my components are re-rendering.
How to alert URL exclude filename.php in javascript?
I have tried this alert but not getting result what exactly i want suppose my url =
Using a variable to switch between input arrays
I am trying to use the value from a drop down list to reference an array which i am using to load some data via an api in the backend. so the
I want to declare the values of the objects within the class and only call the keys when Im declaring a new class. What could I do?
This is what ive done so far. class pricecalc { constructor(obj) { this.parts = object.keys(obj); this.cost = "$"
ES module path alias in browser
I would like to use es modules in browser environment in a convenient way like: import react from 'react'; import
How do I multiply values from different inputs to get a total using Javascript?
I am trying to do a shopping cart where i want the total to automatically change after the quantity is inputted (the total is the price times the
Ad
How to change the color of navigation bar using a button click in javascript?
I made a page where the user could change the page's body/header/footer's background color by inputting the color into a textbox. my functions
How to access KeyValuePair collection as JSON array
I'm making ajax calls to a page in asp.net core 3.1. the response is a jsonresult whose value property is an
What is the better way for passing props to component in React?
Which is better in passing props? passing the whole object as props? or passing them separately? e.g title="sample"
Build table dynamically with PDFmake
I found an example of how to fill the table with pdfmake dynamically, which has 2 columns. now i tried add another column 'height' to the table
How can I open multiple pop-up windows using js?
I'm currently working on an art project and i would like to know how to open multiple pop-up windows in order to make it look like one of those
my number input should accept only numbers[0-9] and [-] character
Should accept and [0-9] and [-] character and it should be max and min 12 characters and 123-456-7890 format
How can i fix Mixed Content issue in mqtt?
I need to connect to broker over websocket. <script
Javascript String concatenation faster than this example?
I have to concatenate a bunch of strings in javascript and am searching for the fastest way to do so. let's assume that the javascript has to
Simplest SOAP example
What is the simplest soap example using javascript? to be as useful as possible, the answer should: be functional (in other
Looking for a simple JavaScript example that updates DOM
I am looking for a simple javascript example that updates dom. any suggestions?
Where do I set a HTML file/page in the root of my React Project to land on example.com/login.html?
I am trying to authenticate a user using a third-party auth server. their redirect_uri states after the user logs in, they will be redirect to
Ad
Angularjs route doesn't load login.html into main.html?
While i am trying to do a single page application using angular.i am unable to load login.html view into ng-view of main.html.kindly some one help
GWT: Static HTML pages should redirect to login.html if not logged in an application
In my application i have some help pages. those pages can be accessed from app when you log in. but if some one bookmarks them they are still able
How can I validate an email address in JavaScript?
I'd like to check if the user input is an email address in javascript, before sending it to a server or attempting to send an email to it, to
I am passing msg from Child1 to Child2 via Parent.But this.prop showing values inside render() but not anywhere else in class
Import react, { component,fragment } from 'react'; import child1 from './child1' import child2 from './child2' class parent extends
React: Passing Child1 state value to Parent and pass back to Child2 from parent
In my app i have two child components, 'foodscreen', 'operationscreen' and a parent component 'desk'. am passing a json variable array to
React - change props at child1 with callback and pass new value to child2
In my app i have a child component, 'menu', where a 'select' state is updated by a click event, like so: menus.jsx
JQuery select each parent, grab height of child1 and set child2 to child1 height
So i have a php script to generate news/case posts from a database which repeats the following html <a
When getting variable from router it returns requestProvider.js.map in node.js
I have a node.js app. when the webpage is rendered the first time all works as expected, but when inspecting the app crashes, and the
Why is firebaseConfig not picked up in javascript?
I am following this
How to populate the firebaseConfig in a Node.js file?
I am trying to make a vehicle or transport tracker application project using google map and
Adding Inline Search function to web page
Is it possible to embed an inline search box into a web page which provides similar functionality to the
Ad
Having one text.txt file and the bot chooses a component of it randomly with discord.js
I want to make a joke bot. (just for some friends on my server). i dont want to use an api. but instead make a big text.txt file with the jokes in
Populate menu with a text file eg text.txt
I am trying to build a kiosk on a local machine only. i'm planning to use javascript to make the menu lists functional. here is my html code
How to Change Material-UI Slider Color
I want to change material ui slider component color i have tried to change css style and it's not working, then i tried the solution given
react-router v5 – nested routes
I can't figure this out even when looking on so answers. i have a layout that looks like this: const dashboard = (props) => (
Use React-Hook with redirect and setTimeout
I have a modal displayed after a register user and i would like it to disappear after a few seconds with a redirect as i write above i use
Redux state updates two seperate objects
I have influencer data object. this object is beeing pulled from database with action fetch_influencer and put inside two different
Invoking context function not working in React
I am trying to update the state of a context from a child component but the context function is not being invoked. to set the scene. here
Component not updating when I change the props that I pass to it in React
I have a functional component which has a child component. the child component displays some text which is passed onto it from the parent
Initialize an array in React component render (in terms of performance)
It is known that we should not use anonymous functions in render because they will be re-create on each render. but what about an array of objects
Cannot use array methods on array of objects
I cannot use array methods on an array of objects. the shellsarray logs out (6) [{…}, {…}, {…}, {…}, {…}, {…}] in the
<FormControl /> does not accept variant Prop
I wonder why <formcontrol /> does not accept the prop variant. according to the
Ad
How to count specific ID's in localStorage?
I'm writing user shopping cart for my portfolio project. i want to save the ids of products as well as count of how many specific ids are in my
Use "include" for ANY string in a array
I have a search function that takes input/query text from a search bar. i want it to work for multiple search terms like "javascript react" or
How to migrate from defaultProps to Default Parameters
I have a loader component which works as expected with defaultprops:
React pass ajax data to children
How i can pass to child component from parent data requested by ajax call? for example i have code like that class parent extends
Can not return from a function
I have a function that looks like following export const checkforavailableagent = (topicid, serviceurl, serviceid) => {
How to hide and display alert in asp.net using c#
So i have a simple asp.net application that when a button is clicked i want to give the user a success alert or error alert depending on their
React Bootstrap Modal show is not working as expected
I am trying to add react bootstrap modal in my application. in one file am dropping the modal and trying to send the param to the modal class.
Error uploading single json file as input as workitem (DesignAutomation)
I could successfully compile design automation web application with input file, as rvt and json attached. but i need to pass only a json file, as
How to make this JS animation effect reverse before it restart?
This is demo text that is animated when it will start animation then this completely disappear and restart. but i want to restart it first reverse
Is it possible to override a function in JS, while preserving its original lexical scope?
I want to slightly modify the code of some function, exposed to me by a third party module. i was thinking of copying the function and modifying
Navbar change when scrolling down, how to make the change responsive?
I am creating a basic web page where i made a very basic transparent navbar with a white fontor font overlapping a dark background banner. the
Ad
Parent node elimination using child value
I am using firebase for my application and would like to be able to delete a parent node via its child value. i have already tried several
How to pass URL parameter to JavaScript function and create iframe element?
I have a beginner's question here... i'm a mobile app, and desktop app developer, so i'm very bad in html & javascript and the entire
Javascript to be applied on different react pages
I need to apply javascript code the most of the react page. basically exporting from a helper file and importing on all those pages where it's
Enabling Button after certain time frame in Jquery html?
I want to enable button after certain time frame and again if i click on this button it should disable for this time frame .how to achieve
push dynamically coming id's and value's in javascript
The question may seem a little confusing so let me explain the situation, i have a category field, that when it's chosen, i get data from api
Sort with mongo and return specific objectId´s first
A structure like this: // (id´s simplified) user: {_id : objectid("4"), name: "max sampleman"} {_id :
In django how to send json object using XMLHttpRequest in javascript
Please help me with how to send json object and receive it it views.py in django. my script: var obj={
Expected server HTML to contain a matching <tag> in <tag>
We are using nextjs and getting this error at page refresh (or first load) my error is: react-dom.development.js:88
REACTJS: TypeError: posts.map is not a function
I know there are a lot of questions about this but after being for one hour trying to solve it i couldn't. i am using reducer hook and
Targeting only the clicked item on a mapped component ( React quiz trivia App)
I'm trying to develop an app with react using the open trivia api. i have mapped a button component (using material ui) to show the different
Wait for for loop to be executed in javascript
I have a for loop that creates products in the database and also want that productsarray to be pushed in another collection ,so i want it to store
Ad
How do I create an HTML element that remains on the page and is unaffected by scroll?
I want to create a button that remains on the screen, no matter how much we scroll through the page, like the button is stuck on the display. is
How to sort an array in lexiographicall order
My goal is to sort the following array
Ad
Blog Categories
Ad