javascript

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...

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 +...

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...

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...

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...

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...

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(item.name === 'mateo'){...

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;

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...

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...

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...

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...

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...

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'...

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...

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...

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...

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!

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...