Posts by Cristiano Gilberto João • 1,045 points
33 posts
-
-1
votes2
answers55
viewsA: Javascrit keypress event does not work on mobile
var ta = document.getElementById("ta"); ta.onkeydown = (e) => { const keyCode = e.which || e.keyCode; if (keyCode === 188 ) { alert('N\u00e3o use <'); e.preventDefault(); } } <textarea…
-
0
votes1
answer28
viewsA: Deactivate the Submit button for a certain time
To achieve this goal, you can use this solution: First you must: Create table userSubmitControl with the following fields: idUser and submitStatus; Script (s2) to check whether the user has already…
-
4
votes1
answer260
viewsA: What is Headless Browser?
Headless Browser (Direct translation - Headless browsers) Headless Browser This just means that there is no graphical user interface (GUI). That is, it is a web browser without a graphical user…
-
5
votes2
answers401
viewsQ: How to disable emoji rendering inside an HTML tag
I have a platform (Website ) where any individual can create content (images and text), however would like to control the rendering of HTML symbols in particular the Emoji within a specific tag (in…
-
0
votes3
answers358
viewsA: JS: store selected values in array
The method find javascript seems to suit better for what you want. //... let sorteados = [99]; function getBingo() { let bola = Math.floor(Math.random() * (75 - 1 + 1)) + 1; /* O método find ()…
-
9
votes1
answer704
viewsA: What is and what is an anonymous function in R?
What is anonymous function in R? One anonymous function Anonymous Function (also known as expression lambda) is a definition of a function that is not linked to an identifier. That is, it is a…
-
2
votes1
answer31
viewsA: How to filter and display the date most acts within a JS object
To find the widget with the most current Date uses the method sort, that is, sort the users array through the field createdAt descending and then searching for the first element of the Array. const…
javascriptanswered Cristiano Gilberto João 1,045 -
1
votes1
answer497
viewsA: Jspdf and responsive canvas
Possible solution: Find the device breakpoint (Device Breakpoints); Through the if/else weigh the screen break according to the device. That is, you have to configure your code according to the…
-
0
votes2
answers50
viewsA: Check if the code exists on another site (remote Extract)
The best method is to use a dedicated instance of Nodeiterator iterating all comments contained in a given page element. Nodeiterator (IE >= 9) function filterNone() { return…
-
2
votes1
answer896
viewsA: Print two or more pages using jsPDF
This solution breaks a large page into multiple pages automatically. window.html2canvas = html2canvas; function demoFromHTML() { const html_source = document.getElementById('employee_detail'); // O…
-
1
votes1
answer338
viewsA: PDF generated goes blank with Jspdf
Try that little hiccup: Transform the html into canvas using the html2canvas (To avoid type error this) Transform the canvas in image And finally the PDF image function demoFromHTML() { const…
-
0
votes6
answers28585
viewsA: How to get Timestamp in Javascript?
Short and thick: + new Date() An operator + fires the method valueOf in the object Date and returns the timestamp (without any change). Details: In almost all current browsers, you can use…
-
4
votes2
answers201
viewsQ: Conditionally add elements into the Javascript Array
When I try to merge two objects using the operator spread conditionally, it works perfectly with both conditions 'true' and 'false': let condition1 = false; let condition2 = true; let obj1 = { key1:…
-
2
votes2
answers3004
viewsA: How to open a local server using Node?
Whenever you load a URL without specifying the port number, the browser default is 80, because 80 is the default port number for HTTP. So if you carry http://stackoverflow.com/questions, the browser…
-
5
votes2
answers482
viewsQ: What is the difference between `UNDEFINED` and `IS NOT DEFINED`
I have an annoying confusion between error messages undefined // (indefinido) and ReferenceError: x is not defined (Erro de Referência: x não está definido). Chrome error messages. var a; a; //…
javascriptasked Cristiano Gilberto João 1,045 -
3
votes2
answers2987
viewsA: "For Development purposes only" error with google maps
The Google Maps API is no longer free as @ngueno said; however, you can use the Mapbox with leaflte js. The Leaflet is the main open source Javascript library for interactive maps compatible with…
-
2
votes1
answer66
viewsA: Google Map gave error!
You must access https://console.developers.google.com and, after creating your KEY API, go to "Google Maps Javascript API" and just ENABLE (by default, DISABLE)…
-
0
votes0
answers19
viewsQ: How to duplicate Objects in Javascript
One of the most frequently requested features by new Javascript developers is how to duplicate an object. It seems as if there should be a native method copy(), right? Turns out it’s a little more…
-
2
votes2
answers45
viewsA: Create a person object as an array within another object
First the literal syntax of the object pessoas (var obj = {chave1:valor,chave2:valor, ...} and the keys must be different) is wrong, it contains the same key for different values; therefore, it will…
-
1
votes2
answers211
viewsA: Javascript function for splitting returning Nan
Actually the logic of your code is correct, the problem is in the way you call the function divicao(1/2). Usually the parameters in javascritp are separated by comma ,, and in this serious case:…
-
0
votes1
answer72
viewsA: Mongo Collections with the same name in different databases
@Alex tries this (Code below) maybe can help you. Basically what I did was create a Collection that will assist in the communication of server - Mongo and client - minimum. That’s because, when you…
-
0
votes2
answers166
viewsA: form-check-input (check if no option has been selected)
Although I didn’t quite understand your question I wrote a script that might help you. To check if no checkbox has been selected you have to use the declaration if/Else , as the example below.…
-
2
votes2
answers38
viewsQ: How to create Object constant in javascript
I want to create Object that cannot be altered, redefined or removed. The aim is to make it possible for objects not to be altered by accident or intentionally.…
-
1
votes2
answers38
viewsA: How to create Object constant in javascript
By combining writable:false and configurable:false, you can essentially create a constant (it cannot be altered, redefined or removed) as an object property, such as: var myObject = {};…
-
1
votes1
answer52
viewsA: Magnetic effect
To apply this effect to any element and whenever you want, you have to place the code responsible for the effect within a function magnetic , which receives as a parameter the selector of the…
-
0
votes4
answers205
viewsA: Catch event that happened on page
To monitor events that are happening on the page, you should first search for the events available on the page and listen to each event individually. Example: window.onload = () => { var ev = '';…
-
2
votes1
answer8331
viewsQ: Removing all spaces from a string using Javascript
I wonder if you have a way to remove all whitespace in a text using Javascript.
-
0
votes2
answers399
viewsA: Typeerror: sheets.foreach is not a Function typescript [on hold]
Usually this type of error arises because the variable leaves is not an array. And in your case to solve this, you have to check if the variable is an array, and if not have to initialize. Use the…
-
1
votes3
answers891
viewsA: How to validate form fields using pure Javascript
Usually when developing a System it is convenient to create a generic form validation function. I tried to create something based on jQuery and underscorejs I might be able to help you: var…
javascriptanswered Cristiano Gilberto João 1,045 -
0
votes2
answers105
viewsA: Input validation with Return in div
To do this validation you need to fetch the input value (textFrete) and compare with the value 35500000, and pass the respective result to the div. And that would be it:…
-
1
votes1
answer91
viewsA: Mount PDF via website
You can use the jsPDF to generate pdf through HTML. For the one you have to: Create such a html structure that you want to print in PDF format; Dynamically populate the structure with input…
-
1
votes2
answers429
viewsA: How do I receive and submit data without refreshing the page?
In principle in the protocol HTTP the client makes the request and the server responds, so somehow you have to make a request. But there are some solutions, such as: Ajax - Ajax allows you to…
-
1
votes1
answer72
viewsA: Open Page with a Key
Yes! You can hear the key click z and open a specific URL. But for this you should use Javascript. And in this case it would look like this: window.onload = () => {…