JavaScript is the world's most popular programming language of the Web and very easy to learn. JavaScript is a very lightweight, explained, and just-in-time compiled programming language. JavaScript is supporting object-oriented, explained, and declarative styles. JavaScript is a prototype-based, multi-paradigm, single-threaded, and dynamic language.
52 questions
How to select table cells vertically and horizontally using javascript or jquery.
const myObject = new Object();
myObject["firstname"] = "Gareth";
myObject["lastname"] = "Simpson";
myObject["age"] = 21;
I'd like to store a JavaScript object in HTML5 localStorage, but my object is apparently being converted to a string.I can store and retrieve primitive JavaScript types and arrays using localStorage,
How do I append an object (such as a string or number) to an array in JavaScript?
I have two radio buttons and want to post the value of the selected one. How can I get the value with jQuery?I can get all of them like this:$("form :radio")How do I know which one is selected?
I need to be able to merge two (very simple) JavaScript objects at runtime. For example I'd like to:var obj1 = { food: 'pizza', car: 'ford' }
var obj2 = { animal: 'dog' }
obj1.merge(obj2);
//ob
Mod note: This question is about why XMLHttpRequest/fetch/etc. on the browser are subject to the Same Access Policy restrictions (you get errors mentioning CORB or CORS) while Postman is not. This que
In JavaScript, how can I format a date object to print as 10-Aug-2022?
How can I display JSON in an easy-to-read (for human readers) format? I'm looking primarily for indentation and whitespace, with perhaps even colors / font-styles / etc.
How can I check the existence of an element in jQuery?The current code that I have is this:if ($(selector).length > 0) {
// Do something
} Is there a more elegant way to approach this? Perhap
What I am looking for:A way to style one HALF of a character. (In this case, half the letter being transparent)What I have currently searched for and tried (With no luck):Methods for styling half of a
Is there a better way to engineer a sleep in JavaScript than the following pausecomp function?function pausecomp(millis)
{
var date = new Date();
var curDate = null;
do { curDate = new
What's the best way of checking if an object property in JavaScript is undefined?
I have the following code in Ruby. I want to convert this code into JavaScript. What is the equivalent code in JS?text = <<"HERE"
This
Is
A
Multiline
String
HERE
Can I convert a javascript string representing a javascript boolean value (e.g., 'true', 'false') into an intrinsic type in JavaScript?I have a hidden form in HTML that is updated based upon a user's
How can I change the class of an HTML element in response to an onclick or any other events using html javascript?
When I want to prevent other event handlers from executing after a certain event is fired, I can use one of two techniques. I'll use jQuery in the examples, but this applies to plain-JS as well:1. eve
What is the difference between using Function.prototype.apply() and Function.prototype.call() to invoke a function?var func = function() {
alert('hello!');
};func.apply(); vs func.call();Are there
I have a JavaScript object like the following:var p = {
"p1": "value1",
"p2": "value2",
"p3": "value3"
};Now I want to loop through all p elements (p1, p2, p3...) And get their keys an
All I want is to get the website URL. Not the URL as taken from a link. On the page loading, I need to be able to grab the full, current URL of the website and set it as a variable to do with as I ple
I have an object x. I'd like to copy it as object y, such that changes to y do not modify x. I realized that copying objects derived from built-in JavaScript objects will result in extra, unwanted pro
I saw this question, 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 ""?
I'd like to round at most 2 decimal places, but only if necessary.Input:10
1.7777777
9.1Output:10
1.78
9.1How can I do this in JavaScript?
I have an array of JavaScript objects:var objs = [
{ first_nom: 'Lazslo', last_nom: 'Jamf' },
{ first_nom: 'Pig', last_nom: 'Bodine' },
{ first_nom: 'Pirate', last_nom: 'Prent
I am looking for a JavaScript array insert method, in the style of:arr.insert(index, item)Preferably in jQuery, but any JavaScript implementation will do at this point.
I saw some code that seems to use an operator I don't recognize, in the form of two exclamation points, like so: !!. Can someone please tell me what this operator does?The context in which I saw this
After an AJAX request, sometimes my application may return an empty object, like:var a = {};How can I check whether that's the case?
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.set
I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off.This happens on page-ready a
I started using Google Apps Script yesterday and I'm struggling in running the code successfully when I attempt to get a range of cells instead of just one cell.This is the complete code, it will show