Public Questions

Ask Question

97 questions


0

Vote

1

Answers

11

View

How to select table cells vertically and horizontally using javascript or jquery.

Apr 16

0

Vote

1

Answers

80

View

I've got a little bit of a problem when I try to run this code. I receive this error:Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, object given inMy problem is in the while st

Mar 02

0

Vote

3

Answers

47

View

const myObject = new Object(); myObject["firstname"] = "Gareth"; myObject["lastname"] = "Simpson"; myObject["age"] = 21;

Jan 29

0

Vote

3

Answers

28

View

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,

Jan 29

0

Vote

4

Answers

30

View

How do I append an object (such as a string or number) to an array in JavaScript?

Jan 29

0

Vote

4

Answers

43

View

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?

Jan 29

0

Vote

4

Answers

19

View

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

Jan 29

0

Vote

4

Answers

35

View

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

Jan 28

0

Vote

5

Answers

29

View

In JavaScript, how can I format a date object to print as 10-Aug-2022?

Jan 28

0

Vote

4

Answers

113

View

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.

Jan 28

0

Vote

5

Answers

20

View

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

Jan 28

0

Vote

4

Answers

28

View

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

0

Vote

4

Answers

26

View

How can I create or use a global variable in a function?If I create a global variable in one function, how can I use that global variable in another function? Do I need to store the global variable in

0

Vote

4

Answers

23

View

I'm looking for a string.contains or string.indexof method in Python.I want to do:if not somestring.contains("blah"): continue

Jan 25

0

Vote

4

Answers

18

View

I am a bit puzzled by the following code:d = {'x': 1, 'y': 2, 'z': 3} for key in d: print (key, 'corresponds to', d[key])What I don't understand is the key portion. How does Python recognize th

Jan 25

0

Vote

4

Answers

40

View

Given a list ["foo", "bar", "baz"] and an item in the list "bar", how do I get its index (1) in Python?

Jan 20

0

Vote

4

Answers

47

View

I need a good explanation (references are a plus) on Python's slice notation.To me, this notation needs a bit of picking up.It looks extremely powerful, but I haven't quite got my head around it.

Jan 20

0

Vote

4

Answers

27

View

What is the difference between a function decorated with @staticmethod and one decorated with @classmethod?

Jan 20

0

Vote

4

Answers

21

View

Is there a shortcut to make a simple list out of a list of lists in Python?I can do it in a for loop, but is there some cool "one-liner"?I tried it with functools.reduce():from functools import reduce

Jan 20

0

Vote

5

Answers

20

View

How do I access the index in a for loop like the following?ints = [8, 23, 45, 12, 78] for i in ints: print('item #{} = {}'.format(???, i))I want to get this output:item #1 = 8 item #2 = 23 ite

Jan 18

0

Vote

4

Answers

20

View

What is the most elegant way to check if the directory a file is going to be written to exists, and if not, create the directory using Python? Here is what I tried:import os file_path = "/my/direct

Jan 18

0

Vote

5

Answers

22

View

How do you call an external command (as if I'd typed it at the Unix shell or Windows command prompt) from within a Python script?

Jan 18

0

Vote

4

Answers

20

View

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

Jan 17

0

Vote

5

Answers

26

View

What's the best way of checking if an object property in JavaScript is undefined?

Jan 17

0

Vote

4

Answers

67

View

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

Jan 17

0

Vote

4

Answers

25

View

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

Jan 17

0

Vote

4

Answers

17

View

How can I change the class of an HTML element in response to an onclick or any other events using html javascript?

Jan 17

0

Vote

3

Answers

54

View

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

Jan 17

0

Vote

4

Answers

19

View

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

Jan 17

0

Vote

3

Answers

20

View

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

Jan 16