Questions tagged as 'javascript'

1
answer

"this" a reliable reference?

Situation I was putting together a widget when I started to analyze a possible error, because the tests actually occurred: Test document.getElementById('teste').addEventListener('click', function(){ n.p.call(this); setTimeo...
asked by 22.03.2016 / 13:10
4
answers

How to get page load percentage?

How to get the size of a page and how it was downloaded to calculate the percentage of your upload. But I would not use any framework , just pure JS. I actually want to try this .     
asked by 17.11.2014 / 20:37
3
answers

Wait for Ajax return in synchronous function

I have an operation that I need to perform synchronously, but some of the information I need can only be obtained via Ajax. I tried to make everything synchronous with a wait for the Ajax return. The problem is that while any function is runn...
asked by 18.02.2014 / 21:01
2
answers

How can I turn line breaks into br / in JavaScript?

In PHP, we can convert a line break to a <br/> through the function nl2br . What about JavaScript? How can I do this in a secure way? I decided to ask the question because I do not know if a simple replace("\n") f...
asked by 13.10.2015 / 15:36
3
answers

How to put Html snippet on all children elements except the last one?

I have a dynamically generated table, and I want to put input inside every td . I can get the id of tr , so I do: $("#id").children().html("<input type='text' value='" + valor + "' />"); So it puts a input wi...
asked by 12.01.2016 / 14:47
2
answers

How to calculate the determinant of a matrix in javascript?

Eg: det([-1, -2, 3], [3, 3, 1], [-1, 2, -3]) // retorna 22 Eg: det([1, 2], [2, 5]) // retorna 1 Eg: det([8]) // retorna 8     
asked by 10.02.2014 / 21:12
3
answers

Writing and reading file via JavaScript

Is it possible (if so how) to do the following method with JavaScript? The person types in a form some arguments, When you click send it will execute a JavaScript code, In this code the function will get the form information and will ope...
asked by 03.03.2014 / 23:18
3
answers

How to execute a function after two or more asynchronous events?

I have a jQuery script that starts two or more asynchronous operations at the same time, and I would like to execute a callback when all are complete. An example would be to start an animation to hide the current page, while I make an Ajax r...
asked by 20.01.2014 / 16:30
3
answers

Simulate placeholder in IE8

I was reading the documentation here and it seems that the placeholder attribute does not work in IE8. Would you have any way to simulate the placeholder you use? HTML example that does not work in IE8: <input type="text"...
asked by 16.12.2014 / 18:30
3
answers

Adding and removing styles from a particular selection at the click of a button

I have a function in javascript that applies a particular style in some classes, and I would like to know how to do this style by clicking the same button. var botao = document.getElementById("troca"); var cores = document.getElementsByClassNa...
asked by 26.11.2015 / 22:29