Questions tagged as 'javascript'

3
answers

Comments weigh?

Reviews weigh? I leave comments throughout my code, will influence something on the site? I'm saying more specifically in HTML, CSS, JavaScript, PHP.     
asked by 19.04.2017 / 14:04
5
answers

Operator "||" in JavaScript variables

Recently reading the code for a plugin , I noticed the definition of variables and objects using the || JavaScript operator. Example: function ola(nome){ nome = nome || "estranho"; return "Olá, " + nome; } I've never seen th...
asked by 24.10.2014 / 14:57
6
answers

Regular expression for e-mail validation

I'm trying to create a regular expression to validate any email, I wrote the expression below, but it is not working as expected: var parse_email = /^[a-z0-9.]+@[a-z0-9]+\.[a-z]+\.([a-z]+)?$/i; What I expected from each section: [a-...
asked by 28.12.2013 / 20:00
1
answer

Is there official documentation for JavaScript?

Is there any official JavaScript documentation like PHP.net or jQuery.com? When we search Google, nothing resembles JavaScript.com ...     
asked by 18.10.2014 / 23:22
3
answers

How to do Icone walk in api Google Maps

In My script below it every 30 seconds causes the icon to change position, only the icon disappears and appears at the next point. What I wanted was for him to walk to the next point as shown in the image below AsIdonotunderstandjavascri...
asked by 26.04.2016 / 02:28
4
answers

How to distribute words in a fixed size area?

I have a list of words and I need to distribute them in an area of fixed dimensions so that it looks like they have been arranged randomly in this space. But I need to make sure the words do not encash, and there are not any big "holes" in the a...
asked by 26.02.2014 / 15:39
3
answers

Why does "return false;" in a click event cancel the link opening?

Why does return false prevail over, for example, a href? We have this code as an example: <!DOCTYPE html> <html> <head> <title>Uma página linda</title> </head> <body>...
asked by 19.02.2015 / 17:03
2
answers

Why should we use anonymous functions with jQuery instead of the function directly?

I have a doubt, some jQuery methods expect a function as a parameter, but to work they should receive an inner function as a parameter instead of a function directly, as in the example below: $("a").on("click", function() { retornaNada(); });...
asked by 03.02.2014 / 16:59
5
answers

Why put JS, CSS and images on another server?

On most sites I noticed that they use another server to load scripts, CSS and images. Why do they use it?     
asked by 04.04.2014 / 14:14
3
answers

Detect if an element contains a class with pure JavaScript

In jQuery, we have the code $("#elemento").hasClass("nomeDaClasse"); This indicates whether an element contains a particular CSS class. How can I achieve the same with pure JavaScript?     
asked by 17.03.2014 / 21:09