Posts by TiagoA • 627 points
33 posts
-
1
votes1
answer195
viewsA: Row 36: Uncaught Typeerror: Cannot read Property 'addeventlistener' of null
Do as user140828 said: your script is running before the DOM is loaded. Just put your script inside window.onload which ensures that the code will be executed after the DOM is loaded: window.onload…
-
0
votes1
answer34
viewsA: img and span tags disappear when I change the input that after I created edit method ;
To edit you recover the innerText of the span that contains the name and by changing you change the innerText of the div that contains the span and the images. Just edit the div innerText by span:…
javascriptanswered TiagoA 627 -
0
votes1
answer100
viewsA: How to put two distinct colors in a chat, the color of the user’s text has to be x and the color of the bot’s text has to be y
When you have a textarea, you have a data input element. The textarea acts similar to the input. To put two different colors in the textarea, you would need to have more than one element inside the…
javascriptanswered TiagoA 627 -
1
votes1
answer117
viewsA: How to access static methods of a class included in the consign in Nodejs?
You’re calling a function that doesn’t exist. As @Leandrade’s comment calls the method as follows: module.exports.home = function (application, req, res) { var auth =…
-
1
votes2
answers38
viewsA: Ajax + PHP saving empty fields in the database
What is happening is that the Ajax request is being cancelled when submitting the form. Your code sends via Ajax and via form at the same time, sending by form makes the browser navigate to the…
-
2
votes1
answer77
viewsA: Delete records in 2 tables with only 1 DELETE command
Simple, just do the Join as in the example above: DELETE Produtos, Fotos FROM Produtos INNER JOIN Fotos on Fotos.id_produto = Produtos.id WHERE Produtos.id = '$id'"
-
0
votes1
answer49
viewsA: Pass php variable in javascript function
It is important to know that PHP runs on the server, and returns HTML. Javascript can be written within HTML tags. So to pass a PHP value to Javascript just do: <?php $valorNoPHP = 'meu valor…
-
-1
votes2
answers91
viewsA: How to generate a 2d matrix with one of the positions chosen separately having a different value?
What you can do is by Math.random to decide whether to print "B" or "8". In this example I am testing whether the random number is even shows "B" else "8": m[i][j]= Math.floor(Math.random()*100) %…
-
0
votes1
answer579
viewsA: Calling child method in parent component within a v-dialog
To make it clearer, I’ll add the answer to my comment here: The problem is this: in the documentation of Vue.js says that the content of this.$refs is populated after rendering, that is, if the…
-
1
votes1
answer30
viewsA: Error while listing table record using PHP PDO
The method fetch returns a result, the method fetchAll returns all. Therefore you should iterate on the result of fetchAll: <?php $sql = "SELECT * FROM crud"; $result = $conn->query($sql);…
-
1
votes1
answer20
viewsA: Jquery.click() function with problems running
If your button is inside a tag <form> will be necessary to cancel the event so that button does not send the form. So: Of: $('#btnPasswordEdit').click(function() { To:…
-
0
votes1
answer108
viewsA: How to create a snap button to get the selected value in a form-control in PHP
It can be solved with Javascript: Declare the variable; Add a button click event; By clicking on the button, retrieve the select via getElementById Save the value of select in the variable var…
-
0
votes1
answer19
viewsA: Help with ajax connection
Sends string as the method serialize jQuery returns a string. Use the method serializeArray to get an array of field names and values. For example the HTML form: <form onsubmit="logar()"…
-
1
votes1
answer44
viewsA: Map markers multiplying when use setInterval
You will have to remove them before adding. An easy way to do this is by using the Layergroup: ... layerGroup = L.layerGroup().addTo(map); async function getIss() { const response = await…
-
0
votes2
answers177
viewsA: How to insert objects using canvas (javascript) and avoid 2 objects in the same position
What you need is a collision detector: What I did: saved the position of each drawn ball in an array; I created a method that traverses the array of the drawn balls and tests the positions of all…
-
2
votes1
answer109
viewsA: Json values without double quotes
Use the constant JSON_NUMERIC_CHECK in the json_encode: $resultado = json_encode($out, JSON_NUMERIC_CHECK);…
-
-1
votes1
answer56
viewsA: How to bring an array that is in a separate file to the application?
Editing the reply as per comment below: <html> <head> <script type="module" src="index.js"></script> </head> <body> </body> </html> index js. import…
-
2
votes1
answer100
viewsA: How to make a upload message while a Promisse loads?
You can call when the function is called: lista.innerHTML = '<li>Carregando...</li>';
-
1
votes1
answer166
viewsA: Python: Web Scraping with dynamic values
For the HTML provided, try: step3 = browser.find_element_by_css_selector('.dijitInline.dijitRadio.dijitRadioChecked input').click()…
-
0
votes1
answer221
viewsA: Show BLOB in iframe src
You already have the Blob, then just turn it into text again: $(document).ready(function () { $('.servidor').click(function () { $('#servidores-bg').hide(); var videolink =…
-
0
votes1
answer37
viewsA: Separate tabs on a page
When using the getElementsByClassName("tabcontent") it selects all elements with the class tabcontent, so to solve just group adding another class in HTML and passing it as parameter in the…
-
0
votes1
answer63
viewsA: How to get the generated url when accessing the instagram photo link using /media/? size=l at the end
What happens is that this link is redirected to another url, so you need CURL to accept redirects. You can do this by setting the option CURLOPT_FOLLOWLOCATION: curl_setopt($ch,…
-
0
votes1
answer33
viewsA: PHP - Multiple upload files not saved with . txt extension
Missed per file index like you did on md5: Of: $extension = $_FILES['file']['name']; To: $extension = $_FILES['file']['name'][$q];…
-
0
votes2
answers55
viewsA: How to remove an array from within another array by filtering those that have the X value in a specific key in Nodejs?
Actually it’s not just Node.js it’s Javascript in general. As you mentioned, you can sort it out in a row with filter, assuming your initial array is called cities: cidades.filter(i => i.city ===…
-
0
votes2
answers65
viewsA: GET by passing all records in URL and POST Presents only the last record
This is because there are several inputs with the same name. Try to change: <b><input type="text" name="cod_produto" id="cod_produto" value="<?php echo $rows['cod_produto'];…
-
0
votes2
answers22
viewsA: Changing order quantity - Cakephp 3.8
In the case of the index you mentioned I think is correct: public function update($produto_id = null) { $session = $this->request->session(); $carrinho = $session->read('carrinho');…
-
2
votes1
answer140
viewsA: How to group and add JSON values in PHP strings
//lê o conteúdo e transforma em array $JSON = json_decode(file_get_contents('dados.json'), true); //itera sobre os valores foreach($JSON['price_usd'] as $i) { // inicializa os…
-
3
votes1
answer95
viewsA: I can’t login after I enter the user’s email and password
The problem is that in the form the field entitled "E-mail" is with name login and in php you are expecting a key email in the $_POST: Of: <p> Email: <input type="email" name="login"…
-
0
votes1
answer45
viewsA: Personal am making a form in php ,however he does not want to add the data in the database
The keys in the superglobal $_POST comes from the body of the request, in your case, comes from the names of the inputs. From what I saw, the address field is named "Address" in index.php and…
-
0
votes1
answer49
viewsA: Laravel, connection between the back office and the front office
It’s very simple, as long as you have the instruction to print a view in your layout: @yield('content'), at the end of your controller’s method you simply return: namespace App\Http\Controllers; use…
-
1
votes1
answer207
viewsA: Display variable only once on a foreach and count total rows of an IF
There are several problems in its implementation: It is not counting correctly, because each iteration has only 1 same; The phrase is repeating itself because it is inside the loop; You can solve…
-
0
votes1
answer247
viewsA: What is the right way to import css and javascript in a project view?
The briefcase public is, as the name says, public, ie, everything it contains is accessible via the url of the server that is running the application. Example if your application is running on…
-
2
votes4
answers9035
viewsA: Mask Car plate in jQuery
Complementing the @rray response, modify the mask to support the new board format: $(document).ready(function(){ $("#placa").inputmask({mask: ['AAA-9999','AAA9A99']}); });…