Questions tagged as 'javascript'

2
answers

Popular inputs according to the value of the selected option

I have 3 arrays, cities, capitals and population. How can I do when clicking on a certain state to appear in the inputs the respective values, ie capital and population of the state selected. var cidades = new Array("Acre", "Bahia", "Minas...
asked by 23.08.2018 / 05:51
1
answer

Order of execution in a Promise

I have the following code: const execute = function() { return new Promise((resolve, reject) => { setTimeout(() => { console.info('Iniciou'); resolve('Executando'); console.info...
asked by 15.11.2018 / 03:26
3
answers

Change data within date attribute

I have a page where I have a timer. That is, when the page opens, after 40 seconds, a section of the site is loaded. This happens due to a third party service, I can not handle this type of information. But I would like to manipulate this i...
asked by 14.08.2018 / 20:38
1
answer

Using Prototype in JS

I need help with using Prototypes, I'm trying to organize and maintain a cleaner code and can re-use my classes at other times ... And in research, using Prototype seems to be advantageous ... (I can have corrected wrong, correct me ...) Firs...
asked by 10.08.2018 / 12:43
3
answers

How to keep the data of an html saved

Well, I need to get the value of a textarea and send it to a second textarea on the same page, but when I refresh I do not want the value to come from the second textarea sum, how to do this using javascript and Ajax? > My Code var textAre...
asked by 12.08.2018 / 23:21
3
answers

How to merge 2 or more Json Objects into 1 Only

Would anyone know if there is a way to join 2 (two) or more Json Objects in Only 1 (one) Json object with all the data unified? How could this union be made? Example below:     
asked by 17.07.2018 / 03:52
2
answers

Escape HTML inside element code - No jQuery

Good evening. I'm developing a chat and I'm breaking my head here in one part. I get the text, I deal with it, I check what img or link is and I just put it inside the <img> and <a> tags, respectively. If it is not a li...
asked by 01.07.2018 / 02:37
1
answer

add and remove the input number

I'm creating an image selection page and wanted to click on choose the number for the input and if it clicks again it leaves the input because there will be several fts chosen body <?php session_start(); if(!isset($_SESSION['tkm'])){...
asked by 27.06.2018 / 21:09
1
answer

problems with (array) object

I have a array of objects . Ex: $array = array (1=$obj1, 2=$obj2...ect) It turns out that I'm converting these objects into arrays also to have an array of arrays instead of a Array of objects with the purpose of transformin...
asked by 03.12.2018 / 14:05
1
answer

Find an ancestor with a given class from any descendant element with pure JavaScript

With jQuery it is quite simple to find an ancestral element that has a given class, id, attribute, and so on. using the .closest() method. For example, in the code below I can select div#principal by clicking on any of your descend...
asked by 29.11.2018 / 23:58