Posts by mrlew • 1,472 points
35 posts
-
1
votes3
answers1347
viewsA: How to create a clickable link within another
Unfortunately, it is not possible. Put a anchor within another is against the specification: 12.2.2 Nested links are illegal Link and Anchor defined by element A must not be nested; a element A…
-
2
votes1
answer164
viewsA: Error in project Missing ) after argument list
In the line 20, you do not concatenate the closing of the brackets. Substitute setLogStr("[" + currHourStr + ":" + currMinStr "] " + newLog, logStack + 1); // ^ // | // aqui for: setLogStr("[" +…
-
6
votes1
answer86
viewsA: Javascript singlethread - Doubt
Your doubt involves a little understanding of how Javascript works. You’re right when you say language is single threaded (at least in the implementation of browsers). As to the asynchronous calls…
-
0
votes2
answers162
viewsA: Changing elements display in another element’s Hover does not work as it should
What is happening is that when the mouse enters the elements .slide-prev or .slide-next, he sends a mouseleave to the .intro-noticias, causing this Flicker. A possible solution would be, in the…
-
0
votes1
answer714
viewsA: CSV In Ruby - Doubt
Good night, first thing, in this code you posted I detected two syntax errors: the keyword Class is in lowercase: class missing a end in the method parse. One to the block do and another for the…
-
4
votes1
answer77
viewsA: Mysql - How to get the table name where the result came from?
You can try: (SELECT 'entrada' as tipo, entrada.* FROM entrada WHERE idUsuario = "1") UNION (SELECT 'saida' as tipo, saida.* FROM saida WHERE idUsuario = "1") Thus, in each record will have a column…
-
8
votes4
answers763
viewsA: What would be a good way to apply events: onMouseOver and onMouseOut, for all img tags?
You are specifying the event in a way inline. The other way is to add an event through the addEventListener(). For this, you need to select all elements you want, iterate on each of them, and set…
-
2
votes2
answers2001
viewsA: Add object inside an object
Well, since you didn’t post the data schema, I will assume that you receive an Object Array in both requests. Then you can do the following: $http.get(base_url +…
-
2
votes1
answer575
viewsA: How to use an ajax return in any part of the script?
Good morning, your question is in the sense of code organization, then I’ll suggest a small refactoring, using a code template that I use in my projects. The intention is only to demonstrate some…
-
4
votes1
answer221
viewsA: Doubt about inserting Javascript object
In your code, you haven’t shown where you’re setting obj_itens, but it is perceived that it is not declared within the scope of the past anonymous function as callback by key Success. Objects are…
-
2
votes2
answers122
views -
0
votes1
answer28
viewsA: Add element content that contains the data-layer "element" in the tag
His element has a class dropdown-list-autocomplete and a id Layer_1abc, and, in your code, you’re looking for id dropdown-list-autocomplete. If you change your selector to:…
-
3
votes1
answer327
viewsA: How do I "update" a Function?
What’s happening is that in the second round, it can pick a random number for the bottom position minor that the previous one, and then the animation goes to the right. One suggestion is to reset…
-
3
votes1
answer472
viewsA: How to access an NGINX server page from an AWS Ubuntu instance over the internet?
You must release door 80 on Security Group of the Instance, which by default is inaccessible. On the tab Inbound, only add the corresponding rule: if you put HTTP in the Type, he already fills the…
-
2
votes2
answers220
viewsA: Problem with access to "Undefined" properties
I realized that you are using Jquery. This means that the return of the selector will always return one object (one "species" array/Collection), although the selector does not find anything (this is…
-
4
votes2
answers1865
viewsA: How to create a shortcut within a page?
The object evento brings read-only properties shiftKey, ctrlKey, altKey, metaKey (Mac command key or Windows key), which may be true or false. You can build something like this:…
-
11
votes3
answers66206
viewsA: Is there a shortcut to indenting the code in Sublime 3?
Does not come by default a shortcut for this command (at least it didn’t come). What you can do is add a custom shortcut: Preferences -> Key bindings, and in the right tab (custom), add something…
-
2
votes2
answers28857
viewsA: How to pass input value to Javascript function
You can create an intermediate function to handle the event and pass the values to your function. Something like that: <head> <script> function onChangePhone(e) { var nome =…
-
1
votes2
answers743
viewsA: Extract arrays and objects from JSON returned with jQuery
Good night, if you specify in the options object sent to the method .ajax the key dataType, you tell what kind of data you are expecting from the server. In your case, it would be something like…
-
2
votes1
answer131
viewsA: Variable does not have its value after done or fail in ajax
Good evening. What is occurring is that the function you created is immediately returning the value of r, and the methods .done and .fail sane assíncronos, i.e., they receive as parameter functions…
-
9
votes5
answers2467
viewsA: What is a deprecated code?
The status deprecated (below I talk about the translation in Portuguese) is normally applied to a functionality (Feature), function, or any code encapsulation that is no longer being officially…
-
4
votes2
answers149
viewsA: Perform calculations between inputs
When you read the data inside a <span></span>, you access the text that is inside the tags through the method .text(). But to read the data that are in a <input></input>, you…
-
0
votes2
answers1276
viewsA: I can’t go to another page with the header function
Despite not being best practice, it’s okay to redirect to the same page as long as you know what you’re doing and can write your logic in a way that never falls into an infinite redirect (the…
-
2
votes1
answer457
viewsA: Pass variables in Jquery . css()
Try to replace this line: $("#desktop-menu").css('top':$("#desktop-top-menu").height().val()); for this: $("#desktop-menu").css('top', $("#desktop-top-menu").height() + 'px'); According to your…
-
0
votes1
answer1308
viewsA: Problems with Jquery load and append loading another php page
You have an element <a> within your <li>, that is running when you click on Parent. I suggest the following approach: Pass to intercept click on anchor (<a>), and not in the list…
-
0
votes2
answers171
viewsA: How to create a dynamic select to use on localhost
I made some modifications to your html and javascript. Here’s the code: <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title>Peixaria</title>…
-
1
votes1
answer436
viewsA: Progressbar does not update according to Xmlhttprequest request - Jquery/Asp.net
Try to replace: if (e.lengthComputable) { progressBar.max = e.total; progressBar.value = e.loaded; display.innerText = Math.floor((e.loaded / e.total) * 100) + '%'; } for: if (e.lengthComputable) {…
-
2
votes3
answers201
viewsA: What’s wrong with my script? - setTimeOut
Try to replace this section: if (scroll >= 400) { window.setTimeout($("#assinatura").addClass("animated jello"), 5000); } for if (scroll >= 400) { window.setTimeout(function() {…
javascriptanswered mrlew 1,472 -
1
votes1
answer768
viewsA: Hide/change console error message
I do not think it is possible to delete or replace this native 404 message from the browser. But: 1) You can add a default message by adding a callback .fail to the method:…
-
6
votes2
answers176
viewsA: PHP/HTML/CSS and JAVASCRIPT script block
You need a syntax highlighter. There are some libraries out there that perform this task: https://highlightjs.org/ http://prismjs.com/ https://craig.is/making/rainbows…
-
16
votes2
answers4666
viewsA: foo and bar - Does it have any special meaning?
About the popular foo and bar, are English terms widely used in programming to illustrate examples (name of variables, methods, functions, classes...). Just this. There is no special meaning.…
terminologyanswered mrlew 1,472 -
2
votes1
answer63
viewsA: Cookies do not work
Good afternoon, as you did not inform which error was giving, I put your code in a fiddle and appeared some errors that related to the loading order of the script. As a general rule, the ideal is to…
-
1
votes1
answer128
viewsA: Complex SELECT with five+ tables
Opa! A possible solution would be to use the UNION. The query would look something like this (untested): SELECT "article" as categoria, articles_id as "id", articles_description as "description",…
-
1
votes1
answer1099
viewsA: Restrict access to the Web API
Oops. The same origin policy implemented by browsers, roughly speaking, is just a way to prevent requests from one domain to another (you upload a website in the A domain that makes an asynchronous…
-
1
votes2
answers705
viewsA: Calling form submission by function
Hello. Apparently you have two identical id’s on the same page, which is invalid by specification, although it refers to different tags. You can change the form id to something like form-apelido and…