Posts by Lucas Henrique • 539 points
16 posts
-
4
votes2
answers377
viewsA: Transform String into Array - Groovy
Use Jsonslurper! The use of Eval is not the best solution in most cases, besides that this solution will fail when the data type is changed, it is not adaptable. So you better use Jsonslurper:…
-
1
votes2
answers1634
viewsA: Image is not displayed when listed on Node Js
When you define something like static (which in this case was the folder public), it gets as publish on the root of your server, so you do not need to set the full path, but from the folder public.…
-
2
votes3
answers845
viewsA: How to simulate Ctrl+v
Extensions using Webextension Apis Extensions created using Webextension Apis can interact with the system’s clipboard using Document.execCommand(). Below is an example that would fit your case:…
javascriptanswered Lucas Henrique 539 -
3
votes2
answers116
viewsA: Function() X Function.call()
.call() invokes the function in a scope defined by you and allows you to pass the arguments one by one (you can set the scope of the function and pass the parameters at the same time). For example…
-
1
votes2
answers1400
viewsA: Vertical alignment with CSS?
Use position: absolute; and bottom: 0; in the text box, and put position: relative; and display: inline-block; in the father, who in this case is .row, follows code: .row{ position: relative;…
-
1
votes2
answers939
viewsA: Javascript - Open new tab and close current
Use single quotes (') or escape character (\) inside the string. Follow code: echo "</script>window.open(https://google.com, '_blank');</script>"; echo…
-
2
votes1
answer220
viewsA: current page effect css and jquery?
You can create a class that would change the style of the active option in the menu, and then with javascript add this class, follow code: CSS: /*Aqui pode ser inserido mais estilos, coloquei só o…
-
1
votes2
answers584
viewsA: image of banner stand on the right side
To do this use the property background-position with the value right, following example: seletor{ background-position: right; } How do you want to position the background of the element, and not the…
cssanswered Lucas Henrique 539 -
1
votes2
answers4866
viewsA: How to take data from a form and place it inside a Javascript object?
To do this you need to set a function to be called when submitting the form on action and assign a id/class for each element, this will facilitate the selection in Javascript. Then just take the…
-
2
votes1
answer582
viewsA: Applying Jquery mask in value and not input
Use Regex and replace(): function mascaraTelefone(value){ value = value.replace(/\D/g,""); //Remove tudo o que não é dígito value = value.replace(/^(\d{2})(\d)/g,"($1) $2"); //Coloca parênteses em…
-
1
votes2
answers51
viewsA: Problem with fadeOut from jQuery!
You can use the event document.onreadystatechange. When it is triggered just check the status if it is complete, hides the #preloader, following example: document.onreadystatechange = function () {…
-
7
votes2
answers52
viewsA: Access this inside event
You need to "set" the scope of the anonymous function that the event receives, to do this use the .bind(), following example: function Foo() { this.bar = function() { console.log('Hi!'); } //Com…
javascriptanswered Lucas Henrique 539 -
0
votes1
answer218
viewsA: Can I use Grid CSS Layout in all new projects?
Depends on the project Every project tends to have a plan. It encompasses the resources, requirements and the public/client. You should analyze your setting, if your users already have support and…
-
4
votes1
answer79
viewsA: My code is not properly comparing variables
Are you comparing strings, use parseInt(variavel) to convert it into a int, and then compare the whole variables, follow example: var red = parseInt(document.getElementById("red").textContent); var…
javascriptanswered Lucas Henrique 539 -
0
votes1
answer88
viewsA: How to align the display of images respecting the individual height of each one?
To do this the structure <html> has to be modified, it is necessary to create two columns, and I advise you to use <div> for the division of columns. Follow the code: HTML:…
cssanswered Lucas Henrique 539 -
4
votes2
answers417
viewsQ: Is using HTML5 tags as CSS3 switches a good practice?
Use the names of tags HTML5 as most CSS selectors is a good practice? Be it because I’m not creative to give names to ids or classes, or by wanting to make HTML code as clean as possible, leaving…