Questions tagged as 'javascript'

3
answers

How to get the key pressed?

I'm breaking my head to create a function that returns the code of the key pressed. I found this: function inicializa(){ document.addEventListener('keydown', pegaTecla); } function pegaTecla(){ var tecla = event.keyCode; alert(tecla);...
asked by 16.02.2015 / 04:58
2
answers

Is it correct to concatenate PHP in JavaScript?

I often use this method, but I do not know if it is appropriate, to redeem the id in JS I use echo php <script type="text/javascript" src ="js/jquery.js"></ script> <script type ="text/javascript"> $("document").ready(functi...
asked by 09.01.2016 / 15:24
2
answers

Is it possible to name a parameter when the function is called?

Can I "access" a specific parameter of a JavasScript function, ie give a value for a given parameter? As an example is better than text (since I can not explain myself right), here's one: In Python, having a function: def funcX(A="A",B="B",...
asked by 28.01.2015 / 15:36
4
answers

How to check if the properties of the window object are native?

I'm using shim that modifies several of the properties in the browsers window object. At this point I need to validate if one of the specific properties is native or a shim. Because shim can modify the native property. For example: (fu...
asked by 06.03.2014 / 15:50
4
answers

How to tell if an element was clicked using pure Javascript

How to tell if a descendant of a <li> was clicked using pure Javascript. <div id="list"> <a href="#">one</a> <a href="#">two</a> <a href="#">three</a> </div> Using...
asked by 02.04.2014 / 02:23
5
answers

console.log () utilities

I was doing a refactoring in a code made in the MVC format, leaving the code more readable, eliminating duplicate code and deleting variables and API's that were no longer being used. By deleting some " console.log(algo.aqui) ", I w...
asked by 07.06.2017 / 19:01
3
answers

How to return key of object with greater value in Javascript?

Let's say I have the following object: var obj = {"frutas": 50, "vegetais": 100, "carnes": 150 }; How would I be able to return the key of the highest value item? Example: obj.maxKey(); // "carnes" I have tried some functions that trea...
asked by 16.03.2015 / 20:57
2
answers

Object declaration in Javascript

function List(){ this.listSize = 0; this.pos = 0; this.dataStore = []; }; Can I consider this code snippet as creating a List object?     
asked by 21.05.2015 / 00:29
1
answer

How to show an element for a few seconds and then hide it?

How can I report a visible : true per time? I want it to be true only for a few seconds then return to false .     
asked by 29.08.2015 / 21:46
1
answer

What is the difference between css and javascript animations?

Lately I've been studying some animations with CSS. However, by researching more about the subject, I ended up checking that it is possible to do animations also with javascript. What's the difference? Which is more feasible? I know tha...
asked by 05.05.2015 / 20:55