Posts by reisdev • 655 points
15 posts
-
1
votes1
answer35
viewsA: Marked ordering with javascript
The problem is that a, in its code, it is an object, and the localeCompare is a class method string. Actually, you should compare the attribute nome_completo of objects a and b. So your code would…
javascriptanswered reisdev 655 -
2
votes1
answer1729
viewsA: Finish repeat loop Repeat Visualg loop
The fimrepita is used when there is no pre-defined stop condition, such as the ate. That is, when it repeats until a stop condition occurs, as below: var x: inteiro x <- 0 repita x <- x + 1 se…
-
9
votes2
answers390
viewsA: Is that a bug in the PHP SWITCH?
There is no bug in the switch. The problem lies in the logic of your code. Because, for all cases, it is returning true, since 0 is less than any of the values of its cases, with the exception of…
-
3
votes3
answers430
viewsA: Loop Usage within the Append Function
If I understand correctly, you want one loop adding each value to the body, right? The method append can’t stand a loop inside it, but it can be used inside a loop. In the snippet below, I used a…
-
1
votes2
answers186
viewsA: Take select description - AJAX
In the snippet below, the function retrieves text from <option> chosen within your select. Once this is done, simply save the text to the tag you want! function myFunction(){ var x =…
-
5
votes4
answers19922
viewsA: Limit the number of SQL query lines
To limit the number of lines, you can user the clauses LIMIT,TOP and ROWNUM. Ex: SELECT estado, num_ocorrencia FROM bra_ocorrencias WHERE nome like 'João' LIMIT 5 ORDER BY num_ocorrencia DESC Or…
-
3
votes2
answers70
viewsA: Javascript or Jquery - how to do a Divs class inventory
You can use the jQuery selector to do this! However, the ids must be unique. So use classes. Snippet below: console.log($('div#cores div.azul').length, 'azuis') console.log($('div#cores…
-
2
votes3
answers946
viewsA: Function to add Multidimensional array elements
There is already a PHP function that performs part of this task, the array_push(). Give a read on documentation. //Função function adiciona($array,$nome,$ano,$cidade){ $pessoa = array('name' =>…
-
2
votes1
answer728
viewsA: How to compare two vectors in java script
It is possible to do this in a very simple way! The Array in Javascript has a method called filter() and a method called indexOf(). filter() The filter() returns an array with the elements that…
javascriptanswered reisdev 655 -
2
votes1
answer34
viewsA: How do you declare date on Node Express?
Take a look at moongoose documentation. In Javascript there is the type Date. Soon, you could build the scheme as: 'use strict' var mongoose = require('mongoose'); var Schema = mongoose.Schema; var…
-
6
votes1
answer574
viewsA: Loading animation
The problem is that the document doesn’t have an event load, only the window. See the snippet below. $(window).on('load',function(){ $('#preload').fadeOut(1000); }); .preload{ position: fixed;…
-
3
votes3
answers67
viewsA: Insert into database table with second form
Both your Forms have the same id, And that’s bad practice. Your form is entering empty data because, when you give a Ubmit, it takes the data from the first form, which is empty, and inserts it into…
-
1
votes1
answer25
viewsA: Why am I unable to fetch any data from a mysql table
It’s a clerical error. You wrote dbnmae instead of dbname. Change your variable $banco for: $banco = "mysql:dbname=banco;host=localhost";…
-
0
votes1
answer314
viewsA: Auto Submit javascript
The problem with your job is that id is not a string, rather an object, which contains the form. You could change its function to: function autoform(form) { alert(form.id);…
javascriptanswered reisdev 655 -
2
votes3
answers66
viewsA: By which means one can remove the dynamic cell inserted in the HTML table
The problem is that you are trying to use the function getElementById(), but no element is found. O this that you are passing to the function is not an id. Therefore, a null reference is returned.…