Skip to content

Author: admin@master

Iterating through FormData in IE

I’m using FormData to send information back to the server. In some cases however I need to read out the data before I send it. Chrome allows you to iterate through the collection but IE does not supply the same methods. The code below works in Chrome: JS Fiddle Does anyone know how to achieve the same r…

ComponentDidUpdate SetState ReactJS Infinite loop

Even though there are many questions with the same subject line, I could not get an answer for my problem. Problem I have a select dropdown. On click of which, I call an Api which fetches some key values. I consider this set of key value input fields as a component. So each and every time onChange of my selec…

How to use MongoDB with promises in Node.js?

I’ve been trying to discover how to use MongoDB with Node.js and in the docs it seems the suggested way is to use callbacks. Now, I know that it is just a matter of preference, but I really prefer using promises. The problem is that I didn’t find how to use them with MongoDB. Indeed, I’ve tr…

getting the status of disabled buttons with JS

I have 7 button on a webpage. When i click on btn7, I want to check how many buttons are disabled. JS How can I check if all buttons are disabled? Edit: I have checked these links but these are advanced and I am not that good with jQuery. JQuery select all elements without disabled AND no readonly? http://api…

multiple conditions for JavaScript .includes() method

Just wondering, is there a way to add multiple conditions to a .includes method, for example: Imagine the comma states “or”. It’s asking now if the string contains hello, hi or howdy. So only if one, and only one of the conditions is true. Is there a method of doing that? Answer That should …

Javascript: remove trailing spaces only

Can anyone help me on how to remove trailing spaces in JavaScript. I want to keep the leading spaces as is and only remove trailing spaces. EG: ‘ test ‘ becomes ‘ test’. Seems like pretty simple but I can’t figure it out. PS: I am pretty sure I can’t be the first one to ask…

chart js 2 how to set bar width

I’m using Chart js version: 2.1.4 and I’m not able to limit the bar width. I found two options on stackoverflow or but neither of one works with the mentioned version. Is there a way to solve this issue without manually modifying the chart.js core library? thanks Answer You were right : The attrib…