Questions tagged as 'javascript'

3
answers

Use symbol in an input text, and disappear when writing

I have a text box, an input type text . And I wanted to insert an image in the corner, for example, a magnifying glass. And when the user starts writing, this magnifying glass disappears. Is it possible to do this in Javascript? <input typ...
asked by 10.02.2014 / 10:53
2
answers

How to subtract decimal numbers?

I made a function to do FadeOut on <div> once I finished loading the page but I can not get the exact value of the end of FadeOut (that would be 0) always give me a number like this: 0.009999999999999247; / p> How can I do to sub...
asked by 19.02.2014 / 05:10
1
answer

CSS recognizing Javascript variables within html, is it possible?

For example, I have a script that takes the mouse coordinates: function posicaoMouse(ev){ ev.preventDefault(); var x = ev.clientX; var y = ev.clientY; console.log(x); console.log(y); }...
asked by 20.10.2017 / 14:05
1
answer

Is there a difference between window.addEventListener and addEventListener?

When I use addEventListener is the same as window.addEventListener or is there a difference?     
asked by 03.10.2017 / 16:44
2
answers

Stopwatch time

I want to know how to implement time in my timer. The timer works, but the minutes go from 60, I need 60 minutes to be converted to hours. <script> // Tempo em segundos var credito = 7200 ; var tempo = credito;...
asked by 07.11.2017 / 12:51
3
answers

Is it possible to dynamically create an object in JS without using eval?

I have the following code: Arr = ["meu", "objeto", "dinamico"]; Val = 100; Eval = ""; obj = {}; for(i in Arr){ Eval += "['"+ Arr[i] + "']"; eval("obj"+Eval+"={}") } eval("obj"+Eval+"="+Val); As you can see, this code dynamically gen...
asked by 15.05.2015 / 14:45
1
answer

Loading PHP into JS is a good practice? [duplicate]

I see quite often in some questions here from SOpt some codes that can PHP variables within scripts in JS. Let's assume that the file below is index.php . <?php $var = "Me mostre"; ?> <script> function mostrar...
asked by 22.01.2016 / 14:05
2
answers

Validate input to only receive numbers with jquery?

I need this input to only receive numbers: <input class="form-control input-sm " placeholder="número" maxlength="4" type="text" ng-model="numero.nJogo" /> This I need to get only values with this formatting (20.00) <input class...
asked by 30.12.2015 / 03:42
2
answers

List generated with JSON data

I'm having trouble querying data from a JSON file within a list in HTML. I put my prototype in the Plunker . Script ... $.getJSON("list.json", function (json){ //alert("Carregou o list.json"); var states = json.states; var...
asked by 31.07.2015 / 22:25
5
answers

jQuery, duplicate click event

I saw here that no can do singleton in javascript . I have a problem with this, I have the following statement: $("#mSalvar").click(function(){ man.bSalvarClick(); }); This generates a duplicate record when the user clicks load t...
asked by 27.07.2015 / 15:40