Questions tagged as 'javascript'

5
answers

How do I change the value of a "date" attribute in JQuery?

I have a data-order attribute on a button and I want it to be incremented as I go adding new days to my list by clicking the button, so I will have: day-1 day-2 day-3 day-4 ... and so on. Does anyone know how I can increment this va...
asked by 31.01.2014 / 15:13
3
answers

How to block special characters in the field

How do I not allow the user to enter special characters such as *-/+.,:;[]{}ªº^~?<> into the question field?     
asked by 08.10.2015 / 22:23
3
answers

How to check if a String is empty in Javascript?

Given the following object: var pessoa = { nome: "fernando" } Note: sometimes I'm getting the object as follows: var pessoa = { nome: "" } How do I check if the name attribute is empty, as the second object shows?     
asked by 23.12.2016 / 14:31
3
answers

How to check if user left the window

I would like to know a way to check if the user exited the window of my page with Javascript, for example, if he switched tab (to search for something in Google for example) the script changes the window title to another title that I define .....
asked by 09.03.2014 / 00:04
4
answers

Sorting an array of objects by date

Well I'm with an array of objects and I need to sort the closest to today to far away from today. For example today is 24/11/2015 ai I have in my array the dates: 30/11/2015 27/11/2015 25/11/2015 30/11/2015 In case the result I'm needing...
asked by 24.11.2015 / 14:08
1
answer

What is the purpose of the third parameter of AddEventListener?

When I want to add a listener of some event in Javascript I use addEventListener . document.addEventListener('click', function (e) { alert('clicked'); }) But I noticed that in some codes, a third parameter is used, which...
asked by 29.08.2016 / 14:19
3
answers

How to organize a project in node

I would like some idea of how I could organize a project in node.js, currently the files look like this: - router.js - controller L controllerUser.js L controllerAuth.js L ... - service L mongodbConnection.js L serviceUser....
asked by 03.06.2018 / 04:22
4
answers

How to check if the first four characters of a string match 'www.'?

What is the best way to verify this? More simply and with better performance. I could only imagine doing so: var string = "www.google.com"; if(string[0] == "w" && string[1] == "w" && string[2] == "w" && string[3] ==...
asked by 09.01.2015 / 14:47
2
answers

How to insert EMOJI - SMARTFONES in MySQL database with PHP? [duplicate]

Well, as the question is very self explanatory, I will only reinforce the question. I have an APP system of conversation, which through HTML , I command for PHP with Ajax , but if the user tries to insert some emoji in> (emotion)...
asked by 03.08.2015 / 18:16
2
answers

What is the difference between setInterval / setTimeout and Web Workers?

I was taking a look at some HTML5 features and came across these WebWorkers whose definition is:    When executing scripts in an HTML page, the page becomes unresponsive   until the script is finished. A web worker is a JavaScript that runs  ...
asked by 01.02.2016 / 18:44