Questions tagged as 'javascript'

2
answers

How to calculate the percentage of likes?

How can I find a way to calculate two values to arrive at a percentage, for example: I have 100 likes in one variable and 10 dislikes in another. In this example, (100 - 10 = 90)% of people who read it liked it ... This is a very s...
asked by 12.09.2017 / 00:09
1
answer

How do I get the name of a callback function in javascript?

For example: function ola() { console.log("Olá =)"); } function executar(callback) { // quero descobrir o nome deste callback que é passado para cá callback(); } executar(ola); In this way, the execute function will execute (rsr...
asked by 06.09.2017 / 08:23
2
answers

Create interactive grid with CSS

I wanted to create an interactive grid where when the person clicked on the image this same appeared next to the shopping site style. <div id='gridImagens> <div> <div> <div> <...
asked by 21.09.2017 / 15:48
1
answer

How to know if an object can be focused

I am making a script to throw errors with javascript and in this function it throws the focus on the field that is with errors. In some cases, when the field is not visible, for example, an error appears in the console, nothing so serious that i...
asked by 28.09.2017 / 18:53
1
answer

Why variable increment function does not work in AngularJS? Am I not accessing the variable correctly?

Hello. I need to change the value of a variable in angularJS but I'm encountering the following problem: "Can not set property 'quantity' of undefined". When I click the add button, I need the quantity variable contained in commodity1 t...
asked by 22.09.2017 / 18:47
3
answers

How to simulate the event click on a select when hovering over a div?

I have the following HTML: <div class="selectOptions"> <select name="select" id="select"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> &l...
asked by 29.09.2017 / 15:53
2
answers

Formatting result for currency [duplicate]

How do I format the value of two input in the currency format by rounding the values. For example, if the commission is 1200 the input return ir and valor líquido give 18% and 1,182, but when it is a broken value, for example...
asked by 26.09.2017 / 16:22
1
answer

Uncaught DOMException: Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED

I need to make a synchronous request and the result has given me this error.    Uncaught DOMException: Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED. The idea behind this code is to make it run one call a...
asked by 27.09.2017 / 14:42
3
answers

Changing button span via jQuery

I have a button that in the click of the same directs an ajax request to an external file that adds a product, however that does not matter much in this case. I wanted to manipulate what is written in the span of button. Every time the us...
asked by 30.08.2017 / 21:32
2
answers

Image about a text

I found a code for you to move the mouse and display a text, I would like it to show a photo. Can be done with css or javascript but I do not know the part of the photo. type this <style> #mostrar{<br /> display:none;<br /&...
asked by 21.08.2017 / 21:06