Questions tagged as 'javascript'

2
answers

How to clone an element in Javascript?

Is it possible to get an exact clone of a particular HTML element? so that the clone contains all the properties exactly the same? If there is one, I would like to know how to proceed with this clone, and also to understand how it is acting,...
asked by 05.02.2014 / 14:53
2
answers

What is the impact of changing the keypress event so that it interacts a 'level up' than the key would do natively?

A simple example, no code needed: If I press CTRL + F , the browser automatically opens a search bar on the page. I made that by pressing CTRL + F it would point to an input inside the system. I want to put several other co...
asked by 27.09.2017 / 17:16
2
answers

How to create an immutable object in JavaScript?

I know that it is possible to "freeze" an object in JavaScript using the Object.freeze method: var x = { foo:"bar", complexo:[1,2,3] }; Object.freeze(x); x.foo = "baz"; // Não tem efeito console.log(x.foo); // bar However, the comple...
asked by 18.02.2014 / 02:09
3
answers

How to identify which city the user is? [duplicate]

In some sites of purchases / services is made an identification or suggestion of the city that the user is to be able to show only the specific products / services of the city of the user. Detail, this will be used only for non-registered u...
asked by 29.12.2015 / 18:55
2
answers

Translation of static website content for 4 languages

What tool have you used to free the translation option of content from a static HTML site to another language? Some jquery plugin, some api? What is the best practice for performance today? Would it be ideal to use something that captures the...
asked by 07.02.2017 / 19:05
1
answer

Filter locations in an area of X km

I'm trying to build a small project where I have a list of places and I can filter them according to a quantity x of km. Ex: Filter all places within a 5km radius of my current location. I have Json with some places in my city and when...
asked by 21.04.2016 / 14:50
1
answer

Performance Webpack Build.js

I'm starting with Webpack. It compiles all javascript and css files into a single file Build.js , Bundle.js , whatever ... In the end it generates a fully mined file using the Production Node command, but it nevertheless gener...
asked by 20.10.2017 / 21:03
3
answers

What is the difference between function and assignment for array?

I have recently made codes in my projects where I need to add items to an array, so I do not know if I should use native language functions like this: array_push($meu_array, 50); or simply assign the value, for example: $meu_array[] = 50;...
asked by 05.01.2018 / 17:30
2
answers

When using prototype (JS)

What's the difference between: Person.prototype.sayHello = function() { alert("Hello, I'm " + this.firstName); }; and Person.sayHello = function() { alert("Hello, I'm " + this.firstName); }; ?     
asked by 21.08.2014 / 20:35
1
answer

How to calculate the dimensions of an SVG element

How to calculate the dimensions of a svg element consistently between browsers? In fact the only one not responding consistently is Firefox. It would be interesting to see the reason for getBoundingClientRect disparities in diff...
asked by 19.05.2014 / 09:52