Questions tagged as 'javascript'

1
answer

Rotate an arrow on a canvas

I need to draw a stream dynamically based on the user's choices. In this flow I want to draw the chosen hypotheses (blue circles with numbers) and the direction between the choices (lines with arrows). For example: node 1 for node 2. JSFiddl...
asked by 16.01.2015 / 11:13
1
answer

How to know the "size" (quantity of properties / attributes) of an object in JavaScript?

Assume an object as follows: vendas = { obs1:{ Venda1:{Regiao:"Norte", Valor: 200}, Venda2:{Regiao:"Sul", Valor:100} }, obs2:{ Venda1:{Regiao:"Norte", Valor: 50}, Venda2:{Regiao:"Sul", Valor:20}...
asked by 07.05.2014 / 16:56
3
answers

Prevent user from pasting special characters

I am creating a system in which the user must type in an input the name of the mother with only alphanumeric characters. I'm using the code below that is working, but I noticed a flaw. Even allowing not to enter other special characters, if th...
asked by 06.01.2015 / 21:50
3
answers

Force execution order of jQuery events

Assuming a page that has multiple events being associated via jQuery. For example, in a certain section, I have: $().ready(function() { foo(); }); And more ahead I have: $().ready(function() { bar(); }); And several more lines...
asked by 03.02.2014 / 23:18
3
answers

How to display the exception message (ex.getMessage ()) thrown by the server in a jquery ajax?

@GET @Path("boleto/{processo}/{resposta}") @Produces({ "application/pdf","application/json"}) public Response gerarBoletoDividaAtivaComCaptcha(@PathParam("processo") String numeroProcesso,@PathParam("resposta") String resposta ) throws DetranExce...
asked by 14.02.2014 / 11:25
1
answer

How and when to use "Labels" in JavaScript?

On objects / JSON we use : for keys and values, for example: {x: 1} As discussed in What is the use of the colon in JavaScript? However, I was working on a small script to try to detect the JSON format before parse to avoid...
asked by 01.11.2017 / 20:58
3
answers

Pick up email response content

I'm using the imap library to sign in to a company account and bring in the new emails when it's an answer of an email I would just pick up the new content but I can not get this just the full conversation. Let me give you an example: A cli...
asked by 05.04.2018 / 21:22
2
answers

Collision system for game in html5!

I'm learning a little about games in html5, css and js. I made a very basic gameplay, player movement, enemy and a collision system , see: var canvas;//o elemento canvas sobre o qual desenharemos var ctx;//o "contexto" da canvas que s...
asked by 04.05.2018 / 02:25
2
answers

Doubt in the declaration between expression arrow and expression of function of an event

I have the following code snippet: self.addEventListener('push', event => {"code here"}); My question is ... this writing format is equal to: self.addEventListener('push', function(event) {"code here"}); And if not, what's the diffe...
asked by 03.11.2016 / 13:19
1
answer

Navigation via HTML or Javascript

I've been working hard with javascript and it makes me use it for almost everything. But I have a question. Is there any problem with semantics, indexing or search results of my page when I use: HTML: <img class="teste" src="img.pj...
asked by 11.01.2017 / 14:01