Skip to content

Tag: javascript

Location Marke disappears when closing modal

I do not speak English, sorry for the mistakes. I’m using bootstrap, jquery, propeller.in and https://github.com/ChadKillingsworth/geolocation-marker I have the following code The problem is that the map does not load inside the div, if I put out the modal content it works normally, I would like to find…

Angular 2/4 String Comparison with Ignore Case

I’m comparing a number of fields in an Angular 2 template and it works for same case properties but returns false for the same string on different cases. Is there a way to make it case insensitive perhaps through a simple pipe? Answer You should use === with toLowercase()

Communicate between two pages / tabs

I’m wanting a JavaScript file to control two HTML files simultaneously. That’s page one. Next is page two. And here is the JavaScript: Page one is working, page two isn’t. I’ve been trying for a day to get pages talking to each other, without success. I’m not sure I understand ho…

make d3 force static layout more quickly

I am new in d3js. I rendered a graph ~10000 nodes. I used web worker and static force render ( because normal render is costing more than twice than the web worker). When the range was 10000, it will cost almost 20 seconds, you can see it at console, so how to reduce this times? jsfiddle Answer You are lookin…

XMLHttpRequest.onload constructor in Javascript?

When making a new XMLHttpRequest, like so There is a method (property ?) called onload. My question is, why we can assign a function to it? like this If onload is a property in XMLHttpRequest, the value of it will change when we assign a new value to it, like a function, right? What is the XMLHttpRequest.onlo…

How to check if key exists in array of object

I am trying to find out if the given key exists in array of object. if the value key exists then i want to return true else false. i giving input of key from text box and then checking if the key exists in array of objects, but i couldn’t get it. here is what i have tried code: if

Checking if a state object is empty

I have a react js state object and would like to execute some code if the object is empty. Is there something wrong with my logic because the code inside the if block is not getting executed. Answer Given that this.state.errors is an object you can do this, Object.keys will return an array or all the keys fro…