array.splice = what does it means?

I would like to understand the meaning of that code fragment. "saveTo" is a array, the programmer assigned a function() to the splice method. I don't understand what does it mean. Is that a override? What is the meaning of the return argu...

Javascript 'this' inside an object literal [duplicate]

This question already has answers here:...

YouTube API playlist shuffle not working?

I have been trying to set-up my youtube api to shuffle my playlist but the order is the same all the time...  Here is the link where I am getting my code from  https://developers.google.com/youtube/iframe_api_reference#setShuffle  Am I calling it rig...

recursive JSON.stringify implementation

I am trying to learn recursion in Javascript, so I figured I'd rewrite the native JSON.stringify function using recursion as a challenge to myself. I almost got my code to work:  var my_stringify = function(obj){           value = obj[ Object.key...

Uncaught TypeError: undefined is not a function when including javascript class in a seperate file

Im new to classes in Javascript, but I trying to create a simple drawing app, with Raphael. The problem I have currently is with some code that works when it is in the same file, but then when I try to take it out and include it, it gives me:  Uncaug...

Error in .map() when callback returns a jQuery object

http://jsfiddle.net/mblase75/NfzbA/ -- using jQuery 1.9.1  var $opts = $('.plant-page').map(function (i, el) {     return $('<option>'); }).appendTo('#change-page select');   The error in the JavaScript console says: Unc...

How to resize DIV to less than its initial width & height?

I want to give the user the ability to resize a DIV to less than its declared width and height. How to ?  Code here: http://jsfiddle.net/hW4nn/  HTML  <div class="divClass"></div>   CSS  .divClass {     resize: both;     overflow:...

Set dynamic Meta Tags and Open Graph tags using jQuery

I'm trying to add dynamic tags using jQuery but it seems not to work. I load my script directly after loading the page.  This is my HTML  <!DOCTYPE html> <html lang="en">   <head>     <script type="text/javascript...

Threejs: How to dynamically change width and height of plane?

Is there a way to easily change width and height of plane dynamically? The code below has no effect.  plane.geometry.parameters.width = width; plane.geometry.parameters.height = height;...

Pass a Javascript Object to an HTML iframe (as an Object)

A MainWindow creates a JavaScript object that the ChildWindow needs to utilize utilize.  My MainWindow.html looks like this at the moment  <html>   <body>     <script>       var varObject = {type:"Error", message:"Lots&#...

yeoman: Using yo webapp followed by adding backbone and backbone.layoutmanager to the mix

I successfully installed a webapp using the yeoman webapp generator plugin.  I wanted to add backbone and backbone.layoutmanager to the mix.  But I get errors such as https://github.com/isaacs/npm/issues/3275 when I attempted to run npm install &...

How to validate form data when browser's javascript is disabled? [closed]

I put some validation to check input data is valid or not. this checking is done by javascript. however, when I disabled my browser's javascript that validation is not working....

javascript Confirm replacement with return true/false

Since jquery UI dialog does not support returning true/false, I need some other way to replace a javascript confirm.  It has to return true/false, so that my validation processes in javascript will run:   var where_to_coupon = confirm(pm_info_msg_013...

Is there a phantomJS injection vulnerability in page.evaluate()?

Using PhantomJS you can execute code in the browser by doing page.evaluate(). Are we opening ourselves up to an attack vector if we allow users to specify code which could be executed in that browser context? Is there a way to escape from the browser...

eslint 'html-webpack-plugin' should be listed in the project's dependencies, not devDependencies. (import/no-extraneous-dependencies)

In my Vs code editor, i am getting following error in simple require statement like:   const HtmlWebpackPlugin = require('html-webpack-plugin')   Error: [eslint] 'html-webpack-plugin' should be listed in the project's dependencies...

Prevent UIWebView for Repositioning for input field

I have an iPad application in which I am displaying an input form as a UIWebView in a UIPopoverController. My popover controller is sized such that it does not have to be resized when the keyboard appears.  When I tap in an input field in the UIWebVi...

Cannot get D3.js to work inside Svelte component (with Rollup)

I've been trying to put the most basic D3 example into a Svelte app and can't get it to work. At first I tried installing D3 as a node module: npm install d3 but this produces the same result (a lack of result) as importing D3 as an external...

Using string as variable name in JS? [duplicate]

This question already has answers here:...

Three.js Child of camera isn't visible

I'm trying to attach an object to the camera so that it can be used more more or less as a GUI element.  My camera is defined as follows:  camera = new THREE.PerspectiveCamera( 45, windowWidth / windowHeight, 1, 2000 ); camera.position.z = 100;...

Passing file contents to outside variable

I'm using a FileReader and the HTML file dialog to read a file in my script. How do I pass this file's contents out of the FileReader.onload function?  function readFileData(evt) {   var file = evt.target.files[0];   var reader = new FileRead...

TypeScript and type aliases

As I know TypeScript allows to create aliases for any types. Such as:   type MyNum = number; var y: MyNum; y = 33; // it's ok   but the followong code is not valid:  type MyType = Object; const dt = new MyType(); // here is an error: 'MyType...

ExpressJS / NodeJS / Promises: Return early from promise chain

When I get a post request on the server to create a new game, I perform a couple of queries. First, I search if the user is already in a game, returning the game if so. Otherwise, I search for an open game in which someone is waiting for an opponent...

How to show <Select > in sorted order

How can I sort the <option> elements of a <select> tag using JavaScript?  Here is the HTML I have:  <form action="example.asp"> <div> <select size="3"> <option value="op2" >Option 2</opti...

send JavaScript array through jQuery AJAX POST

What I want to do is send an JavaScript Array to a PHP file. This is what I got:  var mydata = [];         console.log(document.getElementsByTagName("input")[0].name);         for (var i = 0; i < document.getElementsByTagName('input...

Adding a dropdown arrow inside the input field

<label> Enter your favorite movies:<br/>   <input type="text" name="movies" list="movies"/>   <datalist id="movies">    <label> or select one from the list:   <select name="movies&#...

Append a string at a specific point in the div

I am making a little hang man game in HTML and I am trying to push a letter which the user has guessed correctly to where ever it needs to go in the div. Here is what I have so far:  var words = ['dog', 'mouse', 'horse', '...

How do you get a javascript function to only be running one instance at any one point?

I have some code that I'd like to run on a page. My problem is that I don't want it to be run more than once at any one point. It can run multiple times, but just not while another instance of itself is running. I'm using jQuery and loadi...

Select elements that don't have any classes containing a string

I would like a jQuery selector that selects any elements that do not have a class containing the string '-text';  For example in the following:  <img class="cow" >  <img class="monkey" >  <img class="cow-tex...

OnKeyDown and String.FromCharCode

i've a question concerning the OnKeyDown event. The OnKeyDown event gives a KeyCode but I don't know exactly what kind of code is given. Basically, I was using the String.FromCharCode method to get the real character from what I thought was t...

How to make a jQuery draggable actually snap to an equally sized droppable

I have my draggable and droppable setup correctly using jquery-ui.  They are both the same size, so the draggable should fit nicely on to the droppable.  Is there any way to make the draggable snap in to the middle of the droppable so as to completel...