Questions tagged as 'javascript'

5
answers

How do I add class to the next element when I click the button?

I have a list with several items, and just above this list will have two buttons, "next" and "previous". I wanted the user to click next, for example, to add a different class to the next item in the list and remove the class from the previous i...
asked by 03.02.2014 / 19:02
2
answers

Block unwanted AJAX calls

I tested Google Plus, turned on Firebug and inserted a post. When analyzing Firebug I retrieved the URL where it was executed via AJAX. I copied the URL and ran it in the browser with the active session. It turned out to be an error:    F...
asked by 05.06.2014 / 13:59
4
answers

How to check if the user is online?

I'm developing a project in PHP and using MySQL as a database. I only have one question about how to chat: How to know which users are online right now?     
asked by 17.03.2014 / 18:08
1
answer

upload without refresh with FormData, jquery

I need to update my script and I want to adapt my upload forms to be upados without the need to refresh. I did not use the script for third-party scripts so I searched and found this function of jQuery FormData . I did not rea...
asked by 09.12.2014 / 18:03
3
answers

What is the best way to load JS?

I was facing problems with loading JS, especially IE8, and I had this doubt. I researched a lot, I ended up improving some things. Currently, I load all JS files at the bottom of the page, before the body tag. <body> ......
asked by 10.04.2014 / 20:39
3
answers

Retrieve local time and date of an arbitrary day in an arbitrary timezone, considering daylight saving time

I want to show the day, hour, minute, etc. in an arbitrary timezone, on an arbitrary day. How to talk about timezone conversion is always difficult and confusing, and how to talk about timezone conversions in JavaScript is even more difficult...
asked by 06.02.2014 / 00:13
1
answer

JS Calculator: Unexpected Results

I created a simple calculator in JavaScript, but some results are going wrong, for example, operations like '10 +10 '(returns 18) or '20 / 2' (returns 8). I'm still learning to tinker with the language, so it may be that the error is quite simpl...
asked by 18.12.2017 / 02:01
1
answer

jQuery does not use the HTML5 dataset on date?

When modifying a certain initial value of data of jQuery, I noticed that the value of dataset is not modified. Then I wrote the following test: HTML: <div data-value="initial value" id="div-test-1"></div> <di...
asked by 11.02.2015 / 18:38
2
answers

What's the difference in declarations with [] and {} in JavaScript?

var a=[] var b={} What's the difference in declarations with [] and {} in JavaScript? And in which context is it best to use each? Question in English: SOen     
asked by 20.11.2017 / 23:20
2
answers

What is the difference between event handlers in the DOM?

I would like to know the difference between, for example, <p onclick="fn()">click</p> , addEventListener('click', fn()); and document.getElementById().onclick = fn(); . Is there any relationship with performance...
asked by 18.11.2015 / 00:28