Questions tagged as 'javascript'

4
answers

How to avoid value repetitions in this code?

I made the function below that removes accents from a string using values from an object: function remAcentos(p){ var acc = { // ↓ ↓ ↓ ↓ ↓ 'á': 'a', 'â': 'a', 'à': 'a', 'ã': 'a', 'â':...
asked by 18.03.2018 / 00:55
4
answers

If else with functions

It is possible to use a if-else with functions "function ();" example: if (a > 1){function Save();} else {function NoSave();} I just need to know if functions loaded in head work within if-else in scripts within...
asked by 26.02.2015 / 14:46
3
answers

Simplify mouseenter and mouseleave of multiple images

I have a top menu made up of images and I would like to move all the other images except the selected one to decrease the opacity. But my code gets too big, I wish I could slow down for easier reading and interpretation. There are 9 images in to...
asked by 04.08.2014 / 20:57
3
answers

How do I round off a value from 39.54 to 39

How to round the value from within a class, in the case of 39.54% OFF to 39% OFF Are the values generated by the system?     
asked by 23.04.2014 / 17:03
3
answers

Conditions in Javascript

I recently discovered that it is possible that you can save the result of a condition (such as a if ) to a variable: var x = (1 > 2); // false var y = (2 > 1); // true See the JSFiddle: link What is this feature called?...
asked by 04.07.2014 / 18:51
4
answers

Sort divs by date in the format dd / mm / yyyy

Does anyone know how I can sort a set of divs by a date present in their content? For example: <div class="box" id="box1"> <div class="date">01/05/2018</div> </div> <div class="box" id="box2"> <div...
asked by 19.04.2018 / 19:13
0
answers

WebCam Canvas - Zoom [closed]

Is there a way, a command that allows me to change the zoom of the WebCam? In this code below is where I create my WebCam canvas for Snapshot on the site. I want to apply - zoom, ie increase the coverage area of the Cam. Is it possible?...
asked by 15.06.2015 / 15:16
1
answer

How can I make a Javascript roulette [closed]

Well my question is this: I have an HTML form, which when loading on submit it gives me a random number of 1 to 5 in PHP. What I wanted to know was, how could I do that by clicking on the button PHP would select one of the numbers 1 to 5 rand...
asked by 17.06.2015 / 05:01
0
answers

How to attach a file using Mandrill API?

Ie, guys! I've been trying for two days, but I have not had success yet. I know I'm close, but I need your help. I often get a lot of jobs with only front-end data. So I use the Mandrill API to email form data. In official documentation s...
asked by 05.06.2015 / 23:14
2
answers

How to select text between spaces - REGEX?

I have a string like that of names: var names = ' GEO X GEO3 X GEO4 X'; and I need to do a split using regex to separate only those texts that are between spaces and not X in the arrays I tried: console.log(names); var re = /(^\s...
asked by 18.04.2018 / 22:18