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...
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-...
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...
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...
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>...
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(); });...
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?