1. B

    Show content on button click then hide that button

    I am using Wordpress and I have an Iframe game that I want to prevent this game from running until the button (play game) is clicked. So I want to create a div area (something like a button) when it is clicked the game will display, and that div area disappear. Here is the code that I use...
  2. S

    Access URL in promise each

    I am using Bluebird.js and request-promise NPM module. I want to access promise URL or item.transactionID as in the code below. I try to find many things but failed to work How can we achieve this. paymentIDArray.forEach(item => { let p = rp({ uri: API +...
  3. I

    Convert timestamp from timezone to UTC timestamp?

    I am receiving a timestamp from a third-party API, that looks like: 1540388730994. However, I have been informed that this timestamp is in 'Europe/Amsterdam' timezone. I need to convert this timestamp to UTC, as we store all our dates in UTC. How is this possible in JavaScript? So far I have...
  4. A

    Unable to make my script keep clicking on a button

    I've created a script using node.js in association with puppeteer to click on more button located at the bottom of a webpage to dig out all the headlines from it's landing page. The thing is when I execute my script, It only clicks once and then quits. How can I keep clicking on that button...
  5. R

    Is it possible to store Ajax call as an object?

    This isn't necessarily a "how to" question, but rather an ask to help improve upon my own understanding of JavaScript and Jquery. I've been using Jquery a lot lately in my current job and all of my jquery involves a lot of AJAX calls. In several files I have at least 6 ajax calls for different...
  6. J

    TypeError : undefined is not a function Array.reduce

    Below code is converting object into {"a":"1","b":"2","c":"3","d":"4","e":"5"}, in reduce it is looping through the array and generates the desired output. But then reduce throws TypeError : undefined is not a function. I have gone through many links but those are not the solution for my error...
  7. M

    How to use a string as an object with diferent parameters in javascript?

    I have an array of post that is call test and the next code takes other array and push the post if the name equals something: var test = []; docs = [{name: 'mateo',lastName: 'mateo'}, {name: 'Jhon',lastName: 'smith'}}] docs.forEach(function(item) { if( === 'mateo'){...
  8. A

    I'm trying to update my div element with the value of my nameInput, isn't my code right?

    I have a div element with id="firstDiv" and an input field with id="nameInput". I am trying to get the user input (from id="nameInput") and display it in my div element. shouldn't this work? document.getElementById("firstDiv").innerHTML = document.getElementById("nameInput").value;
  9. B

    How to recursively add unknown primitive elements?

    I want to be able to recursively add elements to a single object, and can't use the salutations[element] syntax as the value of each key will be determined by user input, so I need to primitively use salutations to set each object of greetings. greetings = { key: value, chain: {} } salutations...
  10. L

    How can I convert this to Java, perhaps using Maps

    I picked up a JS code for my assignment and I'm having problems achieving this in Java. My aim is to create predefined values of cities. * Removed JS code * How can I convert this to Java, perhaps using Maps, I have an idea. i just don't know how to put this together perfectly. Map<String...
  11. R

    How to format Array value from Javascript to Java Servlet using Ajax

    I am in need of your help. I have this array being passed from Javascript to Java Servlet using AJAX. Javascript and AJAX snippet code: var BuildingNo = []; $(xml).find('BUILDING').each(function(){ BuildingNo.push($.trim(this).children('BuildingNo').text()); } The value of BuildingNo...
  12. H

    Angularjs ng-model with option list

    I am trying to bind the ng-model "pick" from the option list into the typeahead, is there a way to do so? HTML code: <select ng-model="pick"> <option value="cnames">NAME</option> <option value="caddress">Address</option> <option...
  13. S

    Passing string to function as an object's property in “let” gives “Unexpected token }”

    I'm trying to make a 'generic' charting function which takes a series of parameters for charting different data values with different labels and baseline values. I've created the following function to handle this: function ProcessChart(obj, valToChart, desc, element, baselineVal) { let arr...
  14. N

    Get most two recent items ordered by date from a dictionary array

    Been looking in similar threads but just can't to wrap my head around it. My current item seems way more complicated even for me. Here is my json (sorry it is a bit long): items = [ { 'name' : 'Books', 'types':[ { 'name' : 'Hard Cover'...
  15. A

    Return selected images

    I have an HTML code. There must be 2 questions each of them suggest 4 answers which are images. How can I return in result selected images with javascript? <div class="quest"> <div class="answer"> <input type="radio" value="car1" class="inputimg"/> <label...
  16. I

    How to scale <div> text font size dependent on number of characters?

    I look to make a simple html + css (js if requires) with 2 div blocks of 1000px each with the parent container of 3000px. <div class="blocks"> <div class="block-a">text 1</div> <div class="block-b">text 2</div> </div> I need the div.blocks to be 3000px width and height 1000px; I need...
  17. A

    CSS changing separate elements on hover while all of them are hovered

    I was looking for the solution over stackoverflow, but didn't find anything. I have a set of icons. By default they're grey and only 4 out of 7 are visible. When I hover on div with icons I want 7 of 7 to be visible and grey. And while hovering them, I want every separate icon, that is hovered...
  18. M

    Add last update time in minutes counter in site

    I want to add a "counter" in my site of the last update time. This means that they see a counter of: "Last update: 12 minutes ago." So it displays the minute of the last update ago. It doesnt have to be real update time, if I can reset the timer when I want its good. Thanks for helping me out!
  19. R

    Get specific div when clicking button in php while loop

    I have a while loop spitting out multiple post which each has a div button called 'flag_btn', when clicked I am trying to show the corresponding div container for my form all being displayed from a PHP while loop - $sql = "SELECT * FROM table"; $result = $conn->query($sql); if...
  20. W

    Ajax XHR returns 500 error, but the PHP file works

    index.html (returns 500 error when running this ajax request) function checkUnread(username) { $.ajax( { type: "POST", url: "", data: { user: username }, cache: true, success: function ( data ) {...