Questions tagged as 'javascript'

2
answers

How to execute a function N times in 1 second

I need to run a function N times, but what I did so far did not work, remembering that this N times have to be evenly distributed for 1 second. async function sendImage() { Console.log('teste'); } function sleep(ms) { return new Promis...
asked by 28.12.2017 / 19:31
1
answer

Change integer value to string or insert mask

I have a function that counts, but I need to add a mask to this value. The final value is 3000 only I need for 3,000; Is there a way to change the integer value to another format and still do the count within the function itself? Follow fu...
asked by 22.12.2017 / 17:01
5
answers

Different format for preview and return (bootstrap-datepicker)

I have the following calendar: Início do período: <input type="text" id="calendarioIni" name="dataInicio"> $(document).ready(function() { var dataIni = document.querySelector("#calendarioIni"); var dataFim = document.querySelec...
asked by 15.12.2017 / 18:56
2
answers

Fix Function in Calculator

AsIdonothavemuchknowledgeofjavascriptIneedalittlehelpfromyou.ThisscriptisasimplecalculatorbutIcannotmakesomefunctionswork.IjustneeditWhenchoosingaRadioFielditshowsthevalueofthefieldAndthenimmediatelymultiplythedropdwonnbagsxvalueofthechosenradi...
asked by 29.12.2017 / 15:07
1
answer

Open new pages / links within tab

I found it interesting how the system opens the pages "inside tabs" and I'm trying to make a similar one. I'mhavingtroubleopeningthelinks,butitdoesnotwork,what'smyerror? $(document).ready(function() { //add ajax tabs $("#addNewAjaxTab...
asked by 29.12.2017 / 22:16
2
answers

Execute function when arriving at Div

Is there a way to execute a function only when a div is on the user's screen? Example, I have a div that is in the middle of the site and when a user scrolls to it, or reaches it, I want a function to be executed. Is there an...
asked by 22.12.2017 / 11:59
2
answers

Mark selected in option that has the same id brought in array

I have a select $(".methods option") that has 3 options with forms of payment and each option has a value that has an ID (in case 1, 2 and 3 respectively). I need to mark as selected the option that hit with the IDs brought in data-pay...
asked by 14.12.2017 / 15:34
3
answers

Why with arrow functions is the context different from a common function?

In the snippet I prepared below, I have a table with some simple data. Below the table, there are two labels that account for the total age of the data in the table. The first label is calculated using a common anonymous function, the second one...
asked by 12.12.2017 / 13:21
1
answer

How to Fill Only Selected Input

I'm having a problem popping up a field inside a table that is within a loop For , and one of the titles in this table is a modal, button as it is clicked opens a selection of units of measure . And when the user selects the drive,...
asked by 27.11.2017 / 20:46
1
answer

When to do unit tests in JavaScript?

As far as it is advantageous to do unit tests on the presentation layer, what are the scenarios where Javascript unit testing is advantageous? Is it only advantageous if you have calculations in Javascript? Obs : I'll use Jasmine for test...
asked by 07.12.2017 / 12:50