Questions tagged as 'javascript'

1
answer

My code is not comparing variables correctly

setInterval(function(){ $.getJSON("http://127.0.0.1/recebecores/valor.php", function(array) { quantidade = array[0]; document.getElementById('betAmount').value = quantidade; var tempo = document.getElementById("banner...
asked by 24.07.2017 / 17:24
2
answers

Capture RGBA values [closed]

I have an RGBA value that takes the color from a color palette. I need to get the separate values of each RGBA color component. I created 3 variables: var vermelho = (/*Tem que receber a primeira cor do RGBA red*/); var verde = (/*Tem que r...
asked by 02.08.2017 / 20:23
2
answers

Get all the IDs of the elected ones in jQuery

Well I remove the CSS of a certain element like this: $('#menu' + this.id + '').removeClass('open'); What I need to do and remove from all elements #menu less than informed. I tried to do this: !$('#menu' + this.id + '').removeC...
asked by 14.07.2017 / 14:18
2
answers

How to traverse a hierarchical tree to generate an HTML

I'm having trouble generating a function responsible for traversing and returning a hierarchical tree. Follow JavaSript / JSON code: let tree = { label: 'Elemento A', itens: [ { label: 'Elemento A1',...
asked by 28.07.2017 / 20:14
1
answer

How to check if String is contained in a position of an array?

I need to check if in a String, it contains some word that is in the array. For example: var array = ['faço?', '**fazer**' ] var str = 'como eu posso **fazer** isso?' Would there be a more effective and better performing way of doing th...
asked by 11.05.2016 / 20:04
2
answers

Update key in state when another key is updated

The main idea is based on a shopping cart, when a product is added to the cart (key products ) the key orderTotal is updated. Within the products key I have a object with several products that each contain the value...
asked by 26.07.2017 / 17:35
1
answer

unescape method in javascript

I'm having doubts about script below: function getURLParam(name) { var regex = "[\?&]"+name+"=([^&#]*)"; //mais código return unescape(results[1]); I'm new to javascript , I can not understand what this is: ret...
asked by 29.04.2016 / 18:51
1
answer

Best way to use Module Pattern in javascript

I'm working on a project and using the Module Pattern pattern in the javascript itself. But during the implementation of the project I had some doubts. 1st Doubt: Is there any difference between the two ways "Immediately-Invoked Fun...
asked by 02.09.2016 / 21:25
1
answer

How to get the location of the GPS from who access the website?

Hello I need to develop a website that creates routes, I'm using the Google API's JavaScript. I need to get the location of the user, but the same should be the GPS if the user is accessing through a mobile device, not IP as the function of HTML...
asked by 14.07.2016 / 17:40
2
answers

How to get and count elements that do NOT have a certain CSS property with js / jquery?

I need to count the elements within a div that do not contain the display:none property, then calculate and add up the width of all those elements. The function to calculate and add would be this: $('#gallery').children().each(functi...
asked by 18.07.2016 / 02:31