Questions tagged as 'javascript'

2
answers

invert push order

I'm using push in a request to put new element in a list, but I noticed that push puts the last result down. I want to reverse this. I'm using v-for to list, but I believe the "fix" will be in the same push ... follow the code: dados.ret...
asked by 12.09.2018 / 22:52
2
answers

Regex with javascript to capture words between two characters

My problem is as follows: let texto = "teste :1: e também teste :2:" What I need to do is basically take the positions where these characters appear: 1: and: 2: with regex, since what appears between the two points is dynamic. I...
asked by 08.07.2018 / 15:13
3
answers

Generate randomly in XXXX-0000 format

How to generate a string randomly in XXXX-0000 format where X can be a letter or number? What I've achieved so far was this: var letra = String.fromCharCode(65+Math.floor(Math.random() * 26)) var numero = Math.floor(Math.random()...
asked by 19.04.2018 / 00:42
3
answers

how to pass by value in JavaScript

I have the following situation: let a=[{nome:"oi"},{nome:"xau"}] let b=Object.assign([], a) b[0].nome=5 console.log(b) //[{nome:5},{nome:xau}] console.log(a) //[{nome:5},{nome:xau}] A little while ago I asked here how to pass values witho...
asked by 23.03.2018 / 17:08
4
answers

How to make a Popup that only writes information in the cookie or anything and displays only once on the homepage of the site

I have an adult entertainment website and I need to make an 18 year term to enter the site before ... It will be displayed a screen confirming the age and such of the person so she can click ok if it is bigger. But the jquery code does not run a...
asked by 04.07.2017 / 04:56
3
answers

How to simulate ctrl + v [duplicate]

Is there any way to simulate a ctrl + v using JavaScript? I want to include a button and an input. When you click the button, what is on the clipboard should appear in the input. The code is for an HTML page that shortens links. It has o...
asked by 30.08.2017 / 16:33
3
answers

Extract Array data in Javascript

I have array with the workgroups that the session user belongs to, for example if I write like this: return $data.teste02[0].group_id.name It returns me the first group that this user belongs to, which in this case would be administ...
asked by 28.08.2017 / 15:38
3
answers

Help to filter a JSON with jQuery?

I have this code that filters a JSON object: var filtrar = function (horamin, horamax) { var data = JSON.parse(JSON.stringify(json.aPesquisa)); let result = data.filter(item => { let voos = item.trecho[1].voo.filter(voo => {...
asked by 07.07.2017 / 19:47
2
answers

How to enable and disable button from onclick or select onchange

I've already done this with the radio button, but I'm having trouble doing this from a select. When selecting any employee, you must enable and when you select that it represents no employee, it will disable the button. <form action="questa...
asked by 25.06.2014 / 16:15
2
answers

jQuery Codes for javascript

I am having problems, Javascript is very confusing for me, let's see that I have a function that accomplishes all this in jQuery $(".message-form-content").attr('style', ' '); // Esvazia o style da div $("#load-content").html(success); // Pree...
asked by 13.12.2014 / 17:40