Questions tagged as 'javascript'

3
answers

Force update on client side after site update

The scenario for my problem is the following, I have a website that has been updated, but some customers are reporting that the update was not made for them, which are still in the old site template (probably due to cache persistence ). I've...
asked by 23.03.2017 / 20:28
3
answers

Form filling with return of a json

I'm using a webService (viaCep) to automatically fill in the street, for when the user enters a zip code. The webService returns a json with the information of the street, and of that return I fill in the inputs referring (Street, city, etc .....
asked by 03.05.2018 / 17:22
2
answers

What is the difference between using [CDATA []] inside a tag script?

What is the difference between using or not using the script contents with this CDATA? <script type="text/javascript"> //<![CDATA ... //]] </script>     
asked by 11.12.2015 / 17:34
3
answers

How do I get the current position of a div by its class?

For example: <div class="container"> <div class="position"></div> <!-- Essa tinha que ser position [0]--> <div class="position"></div> <!-- Essa tinha que ser position [1]--> <div class="other...
asked by 20.02.2014 / 20:19
1
answer

When and why to use window before functions?

There are a number of predefined functions in JavaScript that can be used with or without the window object as a prefix. Example: window.setTimeout(function() { }); setTimeout(function() { }); What is the rule for using this objec...
asked by 14.09.2015 / 20:29
1
answer

What is the difference between using the class method and Javascript prototype?

Hello, I would like to know if there is any difference between the normal method (created in class) and prototype. I'm thinking of high-scale type: multiple objects (instances) of a given class. Would there be any performance changes dependin...
asked by 16.12.2014 / 20:16
2
answers

How to select element at the lowest hierarchical level?

I need to select the ul parent of the li element being clicked. But as a li stays within the other the javascript understands that I am clicking on li and all li pais. <ul class="lista"> <li clas...
asked by 28.02.2014 / 20:18
3
answers

How to optimize the sum of the elements of an array

I need to get the value of the sum of the items of a array in JavaScript. The amount of these items can easily reach 2,000 items. Items are of type int , no testing required. ar = [1,3,5,...,2000]; I already have a array...
asked by 27.10.2016 / 18:07
3
answers

How to remove a "listener" that I added via addEventListener?

I usually use the addEventListener function to "listen" to some events, such as click , Websocket connection, and the like. For example: var ws = new WebSocket('ws://echo.websocket.org/'); ws.addEventListener('open', function...
asked by 28.09.2017 / 21:38
2
answers

setTimeout attached to an onload does not work

I have a page in PHP that confirms or does not send the user's email through the contact page. I want it after 10 seconds (long enough for the confirmation prompt to be read), window.location is the homepage of the site. I'm trying this w...
asked by 05.02.2014 / 13:56