Posts by Jason Rabelo • 329 points
22 posts
-
0
votes2
answers54
viewsA: Conditional If inside map() with Function
Good morning, my friend, as callbacks functions javascript does not need you make a structure if complete in this kind of situation, you can do so: searchQuery.map((res) => res.display);…
-
0
votes2
answers50
viewsA: How do I make sure that when I receive a numerical value in the table, it is converted into R$ currency?
you can display any number float or integer using the javascript library consider the example below: const val = 32.93 const real = Intl.NumberFormat('pt-br', {style: 'currency', currency:…
-
0
votes1
answer35
viewsA: Run functions only when the page is loaded
you already tried the document.onload? try the example: document.onload = () => { console.log('carregou') }
-
0
votes1
answer30
viewsA: Hide/Show a drop-down list according to the Radio selected in HTML
Good morning buddy, try this here: <script> var radio01 = document.getElementsByName("radio01"); var ListaOpcoes = document.getElementsByName("ListaOpcoes"); function FuncRadio01() {…
-
0
votes1
answer21
viewsA: I’m having difficulties in ajax to return
Looking at your code there are two things I’ve been able to observe: 1 - here you are assigning an id without "", then it should stay like this: <input type="date" id="valor"> 2 - in your ajax…
-
2
votes4
answers326
viewsA: How to change the value of an object array?
The simplest way is like this: const usuarios = [ { nome: 'Diego', idade: 23, empresa: 'Rocketseat' }, { nome: 'Gabriel', idade: 15, empresa: 'Rocketseat' }, { nome: 'Lucas', idade: 30, empresa:…
javascriptanswered Jason Rabelo 329 -
-3
votes3
answers375
viewsA: What does [] mean after a variable?
let teste; <- this is the declaration of the variable test of type any, or is a variable that can be anything. teste[id] <- this makes the test variable in an array and id is another variable…
-
0
votes2
answers428
viewsA: *ngIf with Boolean
if the result you are receiving is "Não" then he will always return true for "Não" is a string valid you need to work the boolean variables always with false and true, or 0 and 1…
-
0
votes2
answers206
viewsA: Function returning Undefined - Javascript
The value is coming back Undefined because you are not giving return on the function, you put some return but they are returning the value to the callback of the function forEach and its function…
-
0
votes2
answers384
viewsA: Angular - How to disable a field without disabling the value
You can try instead of disabling the field, just set as readonly, or stop working with form in this case and work with ngModel values, in which case you have no problem disabling the field because…
-
3
votes1
answer38
viewsA: Not displaying all array values on the screen
Your problem is exactly on that line: $('.nome td').text(nome); Whenever it is executed, the text of <td> is replaced by a new name, so you only see the last. You need to use the…
-
0
votes1
answer51
viewsA: Pass database data to a View in Adonisjs
You need to convert the result into JSON object like this: async show ({ params, request, response, view }) { const atendimento = await Atendimento.find(params.id_atendimento) return…
-
1
votes1
answer128
viewsA: Using an existing table with Adonisjs
Your code is almost right, you just need to fix one thing, in your controller in the Index function you are calling First wrong the right way would be: Const cliente = await Cliente.query().first()…
-
0
votes4
answers876
viewsA: How to capitalize all words in an array using toUpper?
if you want to transform the array instead of generating a new one you can try this here: palavras.forEach(palavra => palavra = palavra.toUpperCase()); if you want to generate a new array you can…
-
2
votes3
answers848
viewsA: Return divisible by number in an array
I’ll just leave here a simpler option: function busca(array, numero) { if (numero === 0) { return undefined; } return array.find(val => val > 0 && val % numero === 0); }…
-
2
votes1
answer110
viewsA: How to browse an array of Objects within another Object Array
Good night buddy, that object of yours there is a little confusing, but you will manage to interact for it this way: teste.forEach(obj => { Object.keys(obj).forEach(key => {…
javascriptanswered Jason Rabelo 329 -
1
votes3
answers799
viewsA: Print different data from an array according to the element value
Try it here buddy const familia = ["Joana", "Felipe", "Gabriela", "Carlos", "Pedro", "Bruno"] familia.forEach(nome => { console.log(`${nome} ${nome === 'Pedro' ? 'Sousa' : 'Macedo'}`) })…
-
0
votes1
answer137
viewsA: How to transform the result of a querySelectorAll into an array?
Your HTML has a primary error, you cannot define a same id for more than 1 element, in which case you should use class, I made a solution to your example in the code below: <div…
javascriptanswered Jason Rabelo 329 -
0
votes1
answer42
viewsA: Javascript - Read updated HTML when executing function
Good night friend, try to do the following: function teste(){ const selecionados = document.querySelectorAll('#tabela .selecionado') let linhaselecionada selecionados.forEach(selecionado => {…
javascriptanswered Jason Rabelo 329 -
0
votes3
answers48
viewsA: Problem with target identification
Good night Davi Ribeiro, Only your code is missing you pass the event as parameter in the function. try this: <body> <div class = 'tabuleiro' onclick = 'clicar(event)'> <div id = 'a1'…
javascriptanswered Jason Rabelo 329 -
1
votes1
answer47
viewsA: How to separate string in jquery from autocomplete?
Good morning Lxxx_190, By what I intended you have a string that is mounted with 2 information to be displayed in the autocomplete, but when choosing one of the options you need to fetch the…
-
0
votes1
answer49
viewsA: Dependent selects with JSON
Good afternoon friend, you have a problem with this JSON, it does not have the best structure for you to work, the ideal is that the municipality was unique something like: [ {…