Questions tagged as 'javascript'

3
answers

JavaScript eval check if it is safe

I would like to create sequenced objects and to set the object name, I could only do it with the eval() function, I did not find any other alternatives. They say it is uninsured, and subject to attacks. I would like to know if the code...
asked by 05.12.2016 / 16:10
2
answers

Copy data from one field to another [closed]

My client requested that I create 2 fields in the system, one as "Cellular" another as "WhatsApp" and next to the WhatsApp field would have a button to copy the value, if the number is the same, someone has an idea how can I do it?     
asked by 11.11.2016 / 19:43
5
answers

Change divs with the same class

<table> <tr> <td class="valor"> 33</td> <td class="valor"> 88</td> <td class="valor"> 55</td> <td class="valor"> 36</td> <td class="valor"&...
asked by 19.10.2016 / 16:05
3
answers

Exchanging TAGs with JavaScript

Is there any way in JS / JQuery to change a tag in HTML? For example, I have one: <div></div> And I want, let's assume I want it to turn a span: <span></span> In short, change: <div></div> By...
asked by 22.05.2017 / 14:53
2
answers

How to rename the variable during a loop in JavaScript

I want to do an indefinite number of ajax requests, depending on the number of pass urls as a parameter, I only need to know how to increment the (name) of the variable so that the response does not overlap with the previous one. Each request...
asked by 25.09.2017 / 15:51
3
answers

Reduce code repetition with looping

I want to save a few lines of code by creating a for or while loop to reduce what's below. I would assign a variable array to baixo_final[] getting baixo_final[i] for example and the variable i would ran...
asked by 07.01.2017 / 00:54
3
answers

How to remove spaces before and after a string without the JavaScript Trim method

I have this code to remove the first and last spaces but it is removing all the spaces present. Following: const separador = ' '; function filtro(separador, str) { let resultado = ''; let stringNova = ''; for (let i = 0; i <...
asked by 02.02.2018 / 18:00
3
answers

JavaScript Regular Expression for Phone with DDI

I'm having difficulty understanding Regex logic, and I do not think codes that make up the complete phone mask with DDI, DDD, and 8- and 9-digit phones with hyphen changes when typing right in the field using for example the onkeyup event . F...
asked by 10.03.2017 / 17:55
2
answers

Customize an Alert [duplicate]

I have a code that when clicking the button it opens a new tab. Depending on the condition of the report it shows a Alert that by clicking Ok it closes the tab that was opened. Is there any way I can customize this alert, to be more...
asked by 29.10.2015 / 12:39
2
answers

Create PivotTable in JS to use in HTML

I'm trying to create a table in JavaScript and then use it on a page, but this is difficult to do The goal is for the table to represent a set of hospital beds that will be managed through the HTML page. How to do this?     
asked by 05.02.2015 / 17:29