Posts by lfarroco • 992 points
34 posts
-
0
votes2
answers135
viewsA: How to add the size of all JS files
In your line var sizeTotal = $("#inputfileSendTorrent")[0].files[0].size; Files is an array of files and files[0] is the first in the list. You need to pass all elements of this array: var sum = 0;…
-
1
votes1
answer618
viewsA: Problem with ngModel at Angular 2
You are receiving this error because your component does not have a "model" property. Start the object with all properties to avoid error: export class MeuComponente { model: Model = { name: '',…
-
2
votes2
answers297
viewsA: select the same id with different numbering jQuery
You can go through all the elements returned by a query with . each(), see how: $('.waves-effect').each(function(){ //passa por todos os elementos com 'waves-effect' //$(this) vai corresponder ao…
-
1
votes1
answer394
viewsA: how to make a POST request?
Assuming the data you’re going to send is in a variable called data: var data = { code : "4/ux5gNj-_mIu4DOD_gNZdjX9EtOFf&", client_id :"…
-
2
votes1
answer517
viewsA: Installments with date, skipping month of February
I included a check for leap years and day 29 of February. If you put the day 29/02 in a year that is not leap, the date goes to 01/03. function correcaoDia(dia) { if (isNaN(dia)) return false;…
-
2
votes1
answer2137
viewsA: Function returning Warning open_basedir Restriction in Effect. File
Edit your httpd.conf file ( /etc/httpd/httpd.conf ). Look for "open_basedir" and set it to "None" (php_admin_value open_basedir None) In its line 2 the include fails and this generates a series of…
-
1
votes1
answer32
viewsA: URL checking independently of the server
The object window.location has some properties that will help you: In your case, window.location.pathname will return the information you need. The exception will be for pages that implement Urls…
-
3
votes3
answers259
viewsA: Javascript - Make <article> appear by clicking on a <li>
This code does the basics you need, but take a look at jQuery selectors, especially how to select elements by attributes. var scrollDuration = 800; // 1000ms = 1 segundo //ao clicar em uma…
-
0
votes2
answers149
viewsA: Get multiple field values
How did you respond to Lucas Queiroz that all fields are of the same type: var json = {}; $( "#minhaDiv" ).find( "input :text" ) .each(function(){ json[ $(this).attr('name') ] = $(this).val(); })…
-
1
votes2
answers581
viewsA: Redirect a page with javascript when opening a new tab
The object window.opener gives you access to the "mother" tab. With window.opener.location.href you will be able to control her url.
-
1
votes1
answer104
viewsA: What is the best way to generate custom errors
There is no "best way", but general lines. A alert() allows sending an error window to the user, but has the problem of blocking the entire browser in the process - may harm the experience of it. To…
-
2
votes2
answers1266
viewsA: Login within javascript Alert
Within a alert no, but you can get user information through a prompt. https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt The problem is that this is not a very "friendly" way to get…
-
1
votes1
answer1654
viewsA: How to clean or reset form with Angular2
The fields of your form are linked to a template, certain? <input type="text" [ngModel]="cadastro.nome" name="cadastro-nome /> Place a call to a method: <button…
-
0
votes3
answers2011
viewsA: jQuery Run CSS Animation only when content is visible to the user
IE7 or higher: https://stackoverflow.com/a/7557433/5628 function onVisibilityChange(el, callback) { var old_visible; return function () { var visible = isElementInViewport(el); if (visible !=…
-
1
votes2
answers52
viewsA: Refresh page if successful
When you write echo'to aquii no php'; You return a page to the user, which the $.ajax recognizes how success - that is, anything you write will count as success. You can only give echo something…
-
1
votes2
answers437
viewsA: Disable Bootstrap Collapse after first click
Instead of putting the HTML tags (data-toggle="Collapse" and "data-target") on the button that shows your component, show it by js and then disable the click on the button:…
-
1
votes1
answer901
viewsA: Check if dictionary is null or empty?
If you have not set additional properties for your objects, you can use ... if( Object.keys( item ).length > 0 ) all.push(item); ...…
-
3
votes1
answer132
viewsA: Date calculation and onblur tag
Probably the date typed in DATA_VENDA will be in the Brazilian standard (day/month/year), and not in the American one (month/day/year). Soon, you will need to treat this value before providing it to…
-
1
votes2
answers172
viewsA: Open Modal window if difference between dates is equal to X days
Do you refer to the input field named "start"? The event below will run whenever this field is deselected (Blur). Also, a hint: change its formatting to the "2015-03-23" format (without the…
-
4
votes2
answers884
viewsA: Doubt about z-index in separate Ivs
z-index is an anthill. It is best to really put the element that will stand over the outside. Place modals windows and prompts inside the <body> to avoid conflicts. To better understand why…
-
2
votes2
answers3544
viewsA: Calling a jquery function when changing tabs
The user clicks on the list items, so the click needs to be associated with those elements. $('#tabs a').click(function(){ //gere aqui o conteúdo da string str $(this).attr('href').html(str); });…
-
7
votes2
answers683
viewsA: Use or not use CSS/JS within PHP?
It’s all a matter of rapidity and resource saving. Putting all the code inside the page is not feasible, as repetitions of scripts and style sheets on all pages generate a very large and unnecessary…
-
1
votes2
answers892
viewsA: dynamic background - jQuery
There are some ways to perform image Preload in the browser. You can only use CSS - but it leaves a bit of "dirt" in your code, because we need to put some tags to perform the upload. <div…
-
1
votes1
answer234
viewsA: Javascript: Master Tab
If the tab change is done via ajax, save the name of the current tab in a global variable at the time of the change. aba = "Home"; or aba = "Contato"; Then, inside the setInterval:…
-
4
votes2
answers25999
viewsA: How to position one div under another with varying sizes?
Stacking Divs this way (similar to Pinterest) is not possible with CSS alone. There is a library to allow exactly this type of behavior that you seek, Masonry. Check here the list of methods…
-
2
votes2
answers832
viewsA: Load JS on mouse Hover
This page you sent does not load Javascript codes during execution, it just dynamically manipulates some HTML elements. Let’s see how to recreate this effect. When performing the mouseover, the site…
javascriptanswered lfarroco 992 -
1
votes1
answer39
viewsA: Decorative input for certain function
Yes, there are free text editors to use in your projects. One of them is the Ckeditor, an open source and free text editor. Take a look at the documentation and see if it fits your needs.…
-
2
votes2
answers212
viewsA: Comment system with video
Here I will outline in a simplified way how I imagine the approach used. This type of control uses a combination of different technologies, both client and server-side. In the case of videos, it is…
-
1
votes3
answers988
views -
3
votes1
answer2632
viewsA: Bootstrap - Merge lines
You cannot break an Row element (including, it is what ensures the stability of the Bootstrap look!). In Bootstrap Divs are stacked by default, so you can take advantage of it. Change your code to:…
-
6
votes2
answers418
viewsA: Which improves the performance: use "async" or put <script> at the bottom of the page?
Both alternatives will not interrupt the page render, so from the user’s point of view, it has the same result. If you want to support older browsers, put the scripts at the end. async runs the…
javascriptanswered lfarroco 992 -
2
votes1
answer184
viewsA: Animation of div, without CSS3 for future position
Create an array of positions. Each item in the array has position values (top and left). When rearranging, animate the elements to the target position. If you can put an id on each element it will…
-
1
votes4
answers145
viewsA: How to define database tables?
I believe this solution will help you: Tabela FUNCIONARIOS => functionario_id nome 1 João 2 André Tabela HORAS_TRABALHADAS = > funcionario_id mes horas 1 10 20 2 10 12 1 11 5 If you want to…
-
1
votes2
answers282
viewsA: Word selection for phrase formation
Can you use jQuery? If yes, I hope this code helps you. Can you assign an id to each option? If yes, this will make logic simpler - and selecting through the DOM faster. sentenca = []; // criamos…