Javascript Array inside a table does not work

I am new to javascript. I tried to achieve this output in array but I really cannot do it. Output should be: ["test", "test1"], ["test2", "test3"] From this: The data from items: items = [ { data1: "test",

Mongoose Group Results by Year and Month

For the following schema (pseudo code). var Post = { title: "", content: "", date: new Date() } I want to return results grouped by month & year, so something like so, again psuedo code: [ { year: "2016", month: "4&q

Add / subtract / multiply / divide two variables in a string?

I need to output for example "variable + variable" without just displaying the end result. This is probably extremely simple (hopefully), but I'm having trouble with this. var rand1=Math.floor(Math.random() * 21); var rand2=Math.floor(Math.rando

Get time differences in javascript

I want to get the difference between two dates in days, hours and minutes. I tried to do this using the ms from January 1st 1970 like this: var d = new Date() daydiff = ~~((d.getTime()-(Date.parse(SavedReminders[i][7]))) / 86400000); hourdiff = ~~((d

javascript for the loop with 2 tables

This is what I'm trying to accomplish: var result = document.getElementById("o_q1_op1"); document.getElementById("a1_op1").style.height = result.scrollHeight; But I dont want to rewrite it a dozen times, instead want to use arrays stru

convert html markup to an object

I have the below code <html> <head> <title>Hello!</title> </head> <body> <div class="div1"> <h1>This is a headline!</h1> <br> <img src="header-image.png"> </div> &

javascript: created img onclick does not work

Seems weird problem, but perhaps I'm just a noob. Dinamically created IMG, every element (src,id,border,title) ok, except onclick: comment in code. var img = document.createElement('IMG'); var href = result; var idx = result.lastIndexOf("/"); im

How to determine if a Promise is supported by the browser

Does anyone know, using Modernizr or otherwise, if there is a way to detect if the Promise feature is enabled in a browser? I have a polyfill for the functionality, but only want to apply it if the browser does not have a native implementation.Update

Need help for a simple javascript regex

I need to get a specific class with javascript. This class is bootstrap's grid : col-md-8 I need to get the number, I try this : $class = $('div').attr('class'); $number = $class.match(/^col-md-./); I'm real beginner in regex, please help me. EDIT :

javascript literals of C # - avoid warnings

First off, this code does work, but it gives me a low level of annoyance that I'd like to be rid of. I have a .cshtml page that is built using the razor syntax. There is a big, nasty, knockout object living behind the scenes to which many things on t

Mouse rollover issues and jquery problem

I have a problem with jquery effects on few blocks. Mouseenter and mouseleave work only on the first div block while on all others it doesn't. Here is the JS: $(document).ready(function() { $('#mainbox').mouseenter( function () { $('#infobox').fadeIn

Internet Explorer works very slowly by running the JS code

There is a page that uses PHP to fetch search results from Google Search API and then it puts the results on the page some funny way in a circle. The code may look crappy but seems that it works more or less fine in Firefox. When you enter a search q

YUI: Where are the forms?

I am comparing ExtJS and YUI. They seem pretty much tied on the technical side. ExtJs costs money, not much. But YUI is free. Maybe I am missing something obvious, but ExtJs lets you define forms. I didn't see forms in YUI. Where are they?YUI doesn't