Questions tagged as 'javascript'

2
answers

How to generate Math.random starting from a value other than 0?

Personally, I just know the Math.random method and I already know how to generate values starting from 0 to another number by multiplication, eg Math.random () * 20. But I'm trying to do the same thing, starting from 5 to 20, I've already swe...
asked by 04.10.2014 / 07:16
2
answers

SetInterval execution failed

if(inputUser.value == '' || inputPass.value == ''){ setInterval(changeColor("blue"), 3000); alert('Tudo em branco'); } function changeColor(cor){ var prm = "1px solid "+cor; inputUser.style.border = prm; } When I enter a parame...
asked by 15.06.2015 / 01:27
2
answers

Menu java script opens and closes other divs

I have a problem that is simple but I do not use JS at a time so I had a problem. I'm having to create a menu similar to amazon , but the site is responsive and I've done lists. But it did not look good so I'm doing it with DIVs (if a...
asked by 17.06.2015 / 19:17
4
answers

service returning result of a $ http

I'm creating a service for an AngularJS application where I should query a ws and return a value for a variable. My problem is that when I use $http I can not get this value to return, if I use a console.log() ... I do this: ap...
asked by 02.06.2015 / 21:02
3
answers

Apply validation functions in the form of a waterfall

I'm developing a system and want to do validations through functions. I have the checkUsername function that does query in the database to return me whether or not it can register with that username. And then you have other function...
asked by 23.07.2014 / 13:49
2
answers

Combo does not load with call via jquery

I'm trying to fill a dropdown menu which, when the torina is put on a button this works. But since I want this padding to happen automatically as soon as the document is loaded, I jQuery.ready () for this, however, the function it invokes doe...
asked by 29.07.2014 / 15:55
2
answers

How to force the "change" event of an input select, even without choosing another value?

There are two problems: 1 - When loading an input select I tried to use a trigger to force the change, but it did not work. 2 - I have 2 selects. When I actually change the value of the first one, the change event is called and "hides" val...
asked by 22.05.2014 / 20:22
1
answer

Problems IF-ELSE

I have the following code, to look up a certain numbering and check if it exists. In the STR variable, text with numbers is sent. function verifica(str) { if (str.match = '/\d\d\d\d\d\.\d\d\d\d\d') { var old = str.match(/\d\d\d\d\d\.\d\d\...
asked by 25.05.2014 / 05:46
3
answers

How to remove item from an array by filtering by value?

I have a certain array: acoes_selecionadas: ['nome1', 'nome2']; I'm using this function, but splice works based on element ID, I need to find a way to remove it by value. seta_vender: function() { this.vender = !this.vender;...
asked by 14.12.2018 / 04:39
5
answers

Concatenate id by description in an array in javascript

I have an array in js with only an id and a description, for example: var variavel = [{id: 1, descrição: 'Brasil'}, {id: 2, descrição: 'Brasil'}, {id: 3, descrição: 'Chile'}, {id: 4, descrição: 'Chile'},...
asked by 12.12.2018 / 21:13