Suppose I'm familiar with developing client-side applications in jQuery, but now I'd like to start using AngularJS. Can you describe the paradigm shift that is necessary? Here are a few questions that might help you frame an answer:   How d...
Apparently, I have completely misunderstood its semantics. I thought of something like this:   A client downloads javascript code MyCode.js from http://siteA - the origin. The response header of MyCode.js contains Access-Control-Allow-Origin: http:...
What is the best way to copy text to the clipboard? (multi-browser)  I have tried:   function copyToClipboard(text) {     if (window.clipboardData) { // Internet Explorer         window.clipboardData.setData("Text", text);     } else {...
This question already has an answer here:                           Event binding on dynamically created elements?                                      23 answers                                     Suppose I have some jQuery code tha...
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...
What's the difference between addEventListener and onclick?  var h = document.getElementById("a"); h.onclick = dothing1; h.addEventListener("click", dothing2);   The code above resides together in a separate .js file, and they b...
This question already has an answer here:                           $(document).ready equivalent without jQuery                                      33 answers                                     Okay, this might just be a silly quest...
I am using jQuery Mobile, and I am having trouble understanding differences between classic document ready and jQuery Mobile page events.   What is the real difference?  Why should  <!-- language: lang-js -->  $(document).ready() {  });   be...
I've been developing JavaScript for a few years and I don't understand the fuss about promises at all.  It seems like all I do is change:  api(function(result){     api2(function(result2){         api3(function(result3){              // do...
Does Javascript pass by references or pass by values? Here is an example from Javascript: The Good Parts. I am very confused about my parameter for the rectangle function. It is actually undefined, and redefined inside the function. There are no or...
How do I send a cross-domain POST request via JavaScript?  Notes - it shouldn't refresh the page, and I need to grab and parse the response afterwards....
In the following page, with Firefox the remove button submits the form, but the add button doesn't.  How do I prevent the remove button from submitting the form?  <html> <head> <script type="text/javascript" src="jque...
I am storing time in a MySQL database as a Unix timestamp and that gets sent to some JavaScript code. How would I get just the time out of it?  For example, in HH/MM/SS format....
The issue is that when I invoke window.close() or self.close() it doesn't close the window. Now there seems to be a belief that in Chrome you can't close by script any window that is not script created. That is patently false but regardless...
I am after documentation on using wildcard or regular expressions (not sure on the exact terminology) with a jQuery selector.  I have looked for this myself but have been unable to find information on the syntax and how to use it. Does anyone know...
I saw this thread, but I didn't see a JavaScript specific example. Is there a simple string.Empty available in JavaScript, or is it just a case of checking for ""?...
How can I check if a checkbox in a checkbox array is checked using the id of the checkbox array?  I am using the following code, but it always returns the count of checked checkboxes regardless of id.  function isCheckedById(id) {     alert(id);...
The reason for this "escapes" me.  JSON escapes the forward slash, so a hash {a: "a/b/c"} is serialized as {"a":"a\/b\/c"} instead of {"a":"a/b/c"}.  Why?...
IE9 Bug - JavaScript only works after opening developer tools once.  Our site offers free pdf downloads to users, and it has a simple "enter password to download" function. However, it doesn't work at all in Internet Explorer.   You can...
In my main page I have a list of users and i'd like to choose and open a channel to chat with one of them.  I am thinking if use the id is the best way and control an access of a channel like USERID1-USERID2.  But of course, user 2 can open the...
I have a function callWithMagic which takes a callback function as a parameter and calls it with one argument.  const callWithMagic = callback => {   const magic = getMagic();   callback(magic); };   I also have a function processMagic which tak...
I have a few checkboxes:  <input type='checkbox' value="apple" checked> <input type='checkbox' value="orange"> <input type='checkbox' value="pear" checked> <input type='checkb...
I recently updated jQuery from 1.8 to 2.1. I suddenly discovered that the .live() stops working. I get the error TypeError: $(...).live is not a function.  Is there any method I can use in place of .live()?...
I'm refactoring some old JavaScript code and there's a lot of DOM manipulation going on.  var d = document; var odv = d.createElement("div"); odv.style.display = "none"; this.OuterDiv = odv;  var t = d.createElement("tab...
I'm trying to get Javascript to read/write to a PostgreSQL database. I found this project on github. I was able to get the following sample code to run in node.  var pg = require('pg'); //native libpq bindings = `var pg = require('p...
I have the following html code:  <!DOCTYPE html> <html>     <body>         <p>don't print this to pdf</p>         <div id="pdf">             <p><font size="3" color="red">p...
How can I refresh a page with jQuery?...
What is the most efficient way to create an arbitrary length zero filled array in JavaScript?...
In a project I'm collaborating on, we have two choices on which module system we can use:   Importing modules using require, and exporting using module.exports and exports.foo. Importing modules using ES6 import, and exporting using ES6 export...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.