I have a nested data structure containing objects and arrays. How can I extract the information, i.e. access a specific or multiple values (or keys)?  For example:  var data = {     code: 42,     items: [{         id: 1,         name: 'foo'...
I'm trying to open a URL in a new tab, as opposed to a popup window.  I've seen related questions where the responses would look something like:  window.open(url,'_blank'); window.open(url);   But none of them worked for me, the bro...
I have a data structure like this :  var someObject = {     'part1' : {         'name': 'Part 1',         'size': '20',         'qty' : '50'     },     'part2' : {         'name...
Is there any way to disable the Same-origin policy on Google's Chrome browser?...
I'm trying to load a 3D model into Three.js with JSONLoader, and that 3D model is in the same directory as the entire website.  I'm getting the "Cross origin requests are only supported for HTTP." error, but I don't know what...
I am loading an <iframe> in my HTML page and trying to access the elements within it using Javascript, but when I try to execute my code, I get the following error:  SecurityError: Blocked a frame with origin "http://www.<domain>.co...
Is there a quick way to set an HTML text input (<input type=text />) to only allow numeric keystrokes (plus '.')?...
I have been reading online and some places say it isn't possible, some say it is and then give an example and others refute the example, etc.    How do I declare a 2 dimensional array in JavaScript? (assuming it's possible)  How would I acc...
How can I use Unicode-aware regular expressions in JavaScript? For example, there should be something akin to \w that can match any code-point in Letters or Marks category (not just the ASCII ones), and hopefully have filters like [[P*]] for punctu...
Is there a way in jQuery to get all CSS from an existing element and apply it to another without listing them all?  I know it would work if they were a style attribute with attr(), but all of my styles are in an external style sheet....
Recently, I ran some of my JavaScript code through Crockford's JSLint, and it gave the following error:     Problem at line 1 character 1: Missing "use strict" statement.   Doing some searching, I realized that some people add "use...
This question already has an answer here:                           Get visitors language & country code with javascript (client-side) [duplicate]                                      3 answers...
I've got the following objects using AJAX and stored them in an array:  var homes = [     {         "h_id": "3",         "city": "Dallas",         "state": "TX",         "zip": "75201&...
How do you add an onload event to an element?  Can I use:  <div onload="oQuickReply.swap();" ></div>   for this?...
Which method of checking if a variable has been initialized is better/correct? (Assuming the variable could hold anything (string, int, object, function, etc.))  if (elem) { // or !elem   or  if (typeof(elem) !== 'undefined') {   or  if (el...
How can I generate the name of the month (e.g: Oct/October) from this date object in JavaScript?  var objDate = new Date("10/11/2009");...
Say I have an object:  elmo = {    color: 'red',   annoying: true,   height: 'unknown',   meta: { one: '1', two: '2'} };   I want to make a new object with a subset of its properties.   // pseudo code  subset = elmo....
I've created this script to calculate the date for 10 days in advance in the format of dd/mm/yyyy:  var MyDate = new Date(); var MyDateString = new Date(); MyDate.setDate(MyDate.getDate()+10); MyDateString = MyDate.getDate() + '/' + (My...
So apparently because of the recent scams, the developer tools is exploited by people to post spam and even used to "hack" accounts. Facebook has blocked the developer tools, and I can't even use the console.    How did they do that?? O...
Without using a service or constructing watchers in the parent controller, how would one give children states access to the main controller's $scope.     .state("main", {       controller:'mainController',       url:"/main&#...
I've tried  console.log and looping through it using for in.   Here it the MDN Reference on FormData.   Both attempts are in this fiddle.  var fd = new FormData(),     key;  // poulate with dummy data  fd.append("key1", "alskdjflasj...
I have code that looks something like this in javascript:  forloop {     //async call, returns an array to its callback }   After ALL of those async calls are done, I want to calculate the min over all of the arrays.  How can I wait for all of them...
What are the functional differences between the following two Javascript prototypes, and are there any benefits for choosing one over the other?  Option 1:  Person.prototype.sayName = function(name) {    alert(name); }   Option 2:   Person.prototyp...
<p data-foo="bar">   How can you do the equivalent to  document.querySelectorAll('[data-foo]')   where querySelectorAll is not available?   I need a native solution that works at least in IE7. I don’t care about IE6....
I have a bog-standard login form - an email text field, a password field and a submit button on an AIR project that's using HTML/jQuery.  When I hit Enter on the form, the entire form's contents vanish, but the form isn't submitted.  Do...
What exactly is the difference between the window.onload event and the onload event of the body tag? when do I use which and how should it be done correctly?...
There are many ways the value of a <input type="text"> can change, including:   keypresses copy/paste modified with JavaScript auto-completed by browser or a toolbar   I want my JavaScript function to be called (with the current input...
Is it possible to query a HTML Canvas object to get the color at a specific location?...
Is there a really easy way I can take an array of JSON objects and turn it into an HTML table, excluding a few fields?  Or am I going to have to do this manually?...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.