Posts by NoobSaibot • 9,554 points
354 posts
-
1
votes1
answer149
viewsA: Configure HTML variable inside Nodemailer html
You can use Template Strings or concatenate. let titulo = 'Titulo do E-mail'; let ass = 'Assunto do E-mail'; // Template Strings let mailOptions = { html:…
-
1
votes1
answer271
viewsA: Instantiate dynamic named class in Javascript
I do not see the need for this, your code will only have more lines, making it difficult to maintain the code. Simple, use the function eval(). You can create a method to return a class instance.…
-
2
votes2
answers315
viewsQ: Execute method that is inside the "onclick" event
In answering that question, I came across the following situation. Note that onclick in x is an object with two methods, when the element receives the click executes the method click which in turn…
javascriptasked NoobSaibot 9,554 -
0
votes1
answer57
viewsA: Link in the terminal
I believe shortcut is not possible, but you can run command to open. Below examples, when running: npm start It will automatically open the browser after starting the App. Add one of the codes below…
-
2
votes1
answer76
viewsA: How to use Methods of a Extends Class?
According to the documentation, super is used to access the parent object of an object. Define getters and setters. ... set velocidade(km) { this.km = km; } get velocidade() { console.log(`Veículo…
-
3
votes3
answers73
viewsA: When I click on the text it does not change (js)
The estate onclick returns the code of the click event handler on the current element. The correct use would be: var x = document.getElementById("title"); x.onclick = function() { this.innerHTML =…
-
1
votes1
answer505
viewsA: Pass variables on all renders
Yes, it is possible. You can define local variables using the object app.locals or res.locals. Differences between them. app.locals - the value of the properties persists throughout the app’s life.…
-
0
votes2
answers257
viewsA: Separate the contents of a variable via Regex
Just add the character $ at the end of the expressions. var chat1 = "A:How are you?B:I'm fine, thanks."; var regex = /\b(A:)(.*?)(B:)(.*?)$/i; var resultado = chat1.match(regex);…
-
1
votes1
answer461
viewsA: Javascript for validation
I wrote this method, but I think there’s a more dynamic way. function limpaCampo(event) { var value = event.target.value, tamanhoA, tamanhoB; if (event.target.id === 'tel') { tamanhoA =…
javascriptanswered NoobSaibot 9,554 -
5
votes1
answer92
viewsA: Cloning functions in a deep way
Your problem is being with Inheritance, first you must define the object: // Define o objeto paletaDaltonica[cor] = function() {}; Then you inherit the prototype of the original object using…
javascriptanswered NoobSaibot 9,554 -
0
votes2
answers59
viewsA: Fetch values in an object
You can use the method eval, but I don’t think that’s the best option. let base = { misc: { first: 'look', level: { move: 'handler' } }, words: { page: { index: { nav: 'rule', aside: { bottom:…
-
2
votes1
answer610
viewsA: Pick up Input value
Add the event input to the countryside. var inp = document.querySelector('input'); inp.addEventListener('input', function() { var value = this.value; var opt = [].find.call(this.list.options,…
-
3
votes1
answer1580
viewsA: EJS include dynamic
To allow the HTML to be processed, use the output tag <%-. <%- include(page) %>…
-
1
votes1
answer1580
viewsQ: EJS include dynamic
Using Express 4 and template engine EJS, I came across the following: Let’s say I have the following structure: meu_projeto/ +-- server.js +-- views/ ¦ +-- layout.js ¦ +-- admin/ ¦ ¦ +-- index.js ¦…
-
0
votes2
answers1259
viewsA: Unexpected token - React
Incrementing the @nbkhope response, after you make the necessary modifications to use state, your problem will persist due to syntax error. Arrow functions has shorter syntax. The correct for your…
-
1
votes2
answers92
viewsA: CSS with Font Awesome
For this just remove the properties: background-image: url(images/openquote4.gif); background-position: middle left; background-repeat: no-repeat; Import the CSS Font Awesome <link…
-
0
votes1
answer351
viewsA: Error Running App on Mobile
This error is very common on Android, when an object cannot be allocated due to lack of memory space and also, the garbage collector cannot free up space. To resolve, you must add the properties…
androidanswered NoobSaibot 9,554 -
4
votes1
answer229
viewsQ: What does this mean: ". append('<scr'+'ipt .. "?
Yesterday this question was asked: Do something after an external script is fully loaded via jQuery append. Looking at the question and its answer, the following piece of code caught my attention:…
javascriptasked NoobSaibot 9,554 -
2
votes1
answer1443
viewsA: How to use state in a function?
You must make a bind of the method calcula(), to use the this within it. ... constructor(props) { super(props); this.state = { xsemana: '0', meses: '1', minutos: '1', }; this.calcula =…
react-nativeanswered NoobSaibot 9,554 -
1
votes2
answers74
viewsQ: What is the easiest way to classify DOM elements using pure Javascript?
How can I classify elements in the DOM using Pure Javascript, to be more clear, we assume that we have a static products page in addition to the products have a field to sort them by price. body {…
javascriptasked NoobSaibot 9,554 -
2
votes2
answers1944
viewsA: How to repeat a code?
I have taken the liberty of making some amendments, as there is much unnecessary repetition. First, I created a named list operacoes, contains the operations allowed to validate the user input.…
-
1
votes2
answers778
viewsQ: Doubt about the Slice function
To the answer back that one question that the Guilherme Nascimento P. did, opened up a doubt on the use of the function slice, until the moment I had no knowledge of it, and to find it in the…
-
0
votes1
answer135
viewsA: Method of depreciated Mongoosis
As quoted by the author by comment, he was getting the following error: Deprecationwarning: open() is deprecated in Mongoose >= 4.11.0, use openUri() Instead, or set the useMongoClient option if…
-
0
votes1
answer219
viewsA: Dictionary and repeating structure
First let’s understand why we are returning only the amount of the last. Considering the code that is here, on the line 5 you have a named list of l, however, does not use it anywhere else. On the…
-
9
votes1
answer318
viewsA: Is there any pythonic way to make "Slice" from an array?
Python has the function slice, but I believe that the most simplified way of extracting a set of elements should be to use the same notation to obtain a single element: lista[<Índice>], but…
-
1
votes2
answers132
viewsA: How to analyze the input in the while condition?
When you perform scanf("%d", &n) it will store the read value in the address n. Logo just add && n != 0 to analyze the input. int n; while(scanf("%d", &n) && n != 0){…
-
6
votes2
answers5568
viewsA: How to interpolate string in Python?
You can do it like this: preco = 200 unidades = 10 texto_final = "O produto custa R$ %.2f reais e restam %s unidades." % (preco, unidades) print(texto_final) # Outros exemplos nome = 'Thon'; sobre =…
-
0
votes1
answer336
viewsA: Hbs file does not redenrize
Your problem lies in the line below in your file serves you.: app.engine('.hbs', express({ defaultLayout: 'layout', extname: '.hbs' })); According to the documentation, when setting the…
-
0
votes1
answer1755
viewsA: Export html table to excel using javascript by removing a specific column
That answer is an adaptation of that reply here in the Sopt with that other reply in the Soen. Create a button: <button onclick="tableToExcel('Arquivo.xlsx', '#tblExport')">Exportar…
-
2
votes5
answers1389
viewsA: Disable body click for a period of time
I believe that desabilitar event is not possible if I’m wrong correct me. But you can do the following: Create a div <div id="overlay"></div> Define the CSS #overlay { position: fixed;…
-
2
votes4
answers169
viewsA: Which way can I use regular expression to capture just a few link attributes
First does the test to check whether in the URL contains /manga \d Digits only {10} Limit of 10 digits var LINKS = document.querySelectorAll('a'); var RESULTADO =…
-
3
votes2
answers3531
viewsA: Is it possible to change a text from a "content" of a pseudo-CSS element through Javascript?
The rules :before and :after are not part of the GIFT and therefore cannot be changed using the methods GIFT of jQuery. But there are ways to manipulate these elements using Javascript and or CSS.…
-
3
votes2
answers950
viewsA: Is there any method for me to create translations of pages with Javascript or Typescript?
See, just create one object containing the string. let TRANSLATIONS = { 'en': { 'Homepage': 'Homepage', ... }, 'pt-br': { 'Homepage': 'Pagina inicial', ... } } For the elements, define a dataset as…
-
2
votes2
answers9704
viewsA: Fill select cities according to status
Just a searched here and you will find several questions related to the subject, recently I left this reply in the question Check Availability of CEP, as you can see in the reply I left some…
javascriptanswered NoobSaibot 9,554 -
2
votes4
answers990
viewsA: Input mask
Using Regular Expression will come to the result. \d Digits only {4,5} Limits 4 to 5 digits window.onload = function(){ var campo = document.querySelector('#matricula');…
-
1
votes1
answer59
viewsA: Field for by subtitle file URL in Player
Based on your code, I’ve made some modifications. Commented code (function() { 'use strict'; const URLactual = window.location; GM_setClipboard(URLactual); const TEMPLATE = '<video controls>'…
-
2
votes1
answer768
viewsA: Sort php array values!
You can use one of the methods usort and uasort, both work the same way, receives the array and a comparison function. $dados = [ [ 'nome' => 'Drogo', 'donations' => 150 ], [ 'nome' =>…
-
1
votes1
answer1793
viewsA: Icon at the top of a window
You must use the method iconbitmap import Tkinter window = Tkinter.Tk() window.iconbitmap('CAMINHO_COMPLETO_PARA_O_ICON/ICON.ICO') window.mainloop() Reference Tkinter.Tk.iconbitmap…
tkinteranswered NoobSaibot 9,554 -
0
votes1
answer171
viewsA: Problems with Promises from Angularjs
Lack of information Headers var config = { headers : { 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;' } } See working Here in the Sopt does not work the snippet, but you can see…
-
0
votes3
answers6042
viewsA: How to limit the size of Body to be centered on the Css screen
Responding to the comments, is it possible ? Yes, see some examples: html, body { height:100%; } html { display:table; width:100%; } body { display:table-cell; text-align:center;…
-
1
votes1
answer156
viewsA: Rename when exporting XLS
Here a solution can have a simpler way of doing. let tableToExcel = (nome, tabela) => { let link = document.querySelector('#link-to-download'); let conteudo = document.querySelector(tabela); let…
javascriptanswered NoobSaibot 9,554 -
0
votes2
answers465
viewsA: How not to show jQuery UI autocomplete input the HTML of the variable?
Reading the documentation of Autocomplete, I couldn’t find anything talking about the option html: true/false, but talks about the extension jquery.ui.autocomplete.html.js created by Scott González.…
-
1
votes2
answers1292
viewsA: Python 3 - Birth Date Problems
One observation to make: method used to calculate the age of the person is not correct, as it must make the complete check with the day and month of birth. In your condition, you start by checking…
python-3.xanswered NoobSaibot 9,554 -
2
votes2
answers951
viewsA: Draw a circle on an image with Javascript
You can use the library D3.js, take this example: // Define as variáveis // Campos para armazenar a posição let posX = document.querySelector('#posX'); let posY = document.querySelector('#posY'); //…
-
1
votes1
answer32
viewsA: Problem entering data into database
The problem is because you are not using a button to send the message. Alter: <a href="includes/adcCategoria.php" class="btn btn-light btn-lg btn-block">Cadastrar</a> To: <input…
-
1
votes1
answer996
viewsA: Trouble Generating PDF with hidden content with jsPDF and html2canvas
A while ago I answered that question Error - jsPDF PDF Generation, today it is with another title, it may not be working because you are using the plugin addHTML which has been discontinued. To find…
-
6
votes1
answer7958
viewsA: Using jsPDF to generate PDF
A while ago I answered that question Error - jsPDF PDF Generation, today she is with another title, the code will work for you too. I recommend you read the answer I gave in the aforementioned…
-
3
votes4
answers9155
viewsA: Change the background of input filled in by Chrome autocomplete
To complete the @Laérciolopes reply you can also change the background color of the fields select and textarea which have been filled in automatically. input:-webkit-autofill,…
cssanswered NoobSaibot 9,554 -
1
votes4
answers1768
viewsA: How to generate a serial key that contains a prefix in the first 5 characters?
You can create a class, example: Class serial.class.php class Serial { private $prefixo = ""; public $letras =…
phpanswered NoobSaibot 9,554 -
1
votes1
answer116
viewsA: Ajax By Form Data= Variable Undefined
According to the documentation, the method getElementById returns the element reference through your ID, so you have no reason to use hashtag. var form = document.getElementById('novo'); But you can…