Java Script

JavaScript (not to be confused with Java) is a high-level, dynamic, multi-paradigm, weakly-typed language used for both client-side and server-side scripting. Its primary use is in rendering and allowing manipulation of web pages. Use this tag for questions regarding ECMAScript and its various dialects/implementations (excluding ActionScript and Google-Apps-Script).

65 votes
5 answers
1.7K views
59 votes
30 answers
1.5K views
Simplest code for array intersection in javascript

What's the simplest, library-free code for implementing array intersections in javascript? I want to writ

avatar
Clarice
0 1 0 9
asked 07 September, 2021
53 votes
27 answers
1.2K views
How do you implement a Stack and a Queue in JavaScript?

What is the best way to implement a Stack and a Queue in JavaScript? I'm looking to do the shunting-yard

avatar
Tuan
0 1 0 9
asked 07 September, 2021
55 votes
20 answers
417 views
Can I hide the HTML5 number input’s spin box?

Is there a consistent way across browsers to hide the new spin boxes that some browsers (such as Chrome) rende

avatar
Tana
0 1 0 9
asked 07 September, 2021
55 votes
12 answers
775 views
Why don't self-closing script elements work?

What is the reason browsers do not correctly recognize: <script src="foobar.js" /> <!-- self-closing

avatar
Xavier
0 1 0 9
asked 07 September, 2021
51 votes
29 answers
2.2K views
Retrieve the position (X,Y) of an HTML element relative to the browser window

I want to know how to get the X and Y position of HTML elements such as img and div in JavaScript relative to

avatar
Carmelina
0 1 0 9
asked 07 September, 2021
55 votes
20 answers
1.5K views
How do I modify the URL without reloading the page?

Is there a way I can modify the URL of the current page without reloading the page? I would like to access th

avatar
Sydney
0 1 0 9
asked 07 September, 2021
56 votes
23 answers
2K views
Storing Objects in HTML5 localStorage

I'd like to store a JavaScript object in HTML5 localStorage, but my object is apparently being converted

avatar
Santiago
0 1 0 9
asked 07 September, 2021
59 votes
30 answers
2.7K views
jQuery Get Selected Option From Dropdown

Usually I use $("#id").val() to return the value of the selected option, but this time it doesn't work. T

avatar
Suzan
0 1 0 9
asked 07 September, 2021
58 votes
22 answers
1.2K views
jQuery get specific option tag text

All right, say I have this: <select id='list'> <option value='1'>Option A

avatar
Elicia
0 1 0 9
asked 07 September, 2021
54 votes
14 answers
1.1K views
How can I get jQuery to perform a synchronous, rather than asynchronous, Ajax request?

I have a JavaScript widget which provides standard extension points. One of them is the beforecreate function.

avatar
Wilfredo
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
2.4K views
How to check if element is visible after scrolling?

I'm loading elements via AJAX. Some of them are only visible if you scroll down the page. Is there any wa

avatar
Alphonso
0 1 0 9
asked 07 September, 2021
57 votes
16 answers
1.1K views
How do I set/unset a cookie with jQuery?

How do I set and unset a cookie using jQuery, for example create a cookie named test and set the value to 1?

avatar
Omar
0 1 0 9
asked 07 September, 2021
55 votes
14 answers
2.3K views
jQuery document.createElement equivalent?

I'm refactoring some old JavaScript code and there's a lot of DOM manipulation going on. var d = do

avatar
Brianne
0 1 0 9
asked 07 September, 2021
55 votes
17 answers
3K views
window.onload vs $(document).ready()

What are the differences between JavaScript's window.onload and jQuery's $(document).ready() method?

avatar
Tana
0 1 0 9
asked 07 September, 2021
55 votes
24 answers
2.5K views
Check if checkbox is checked with jQuery

How can I check if a checkbox in a checkbox array is checked using the id of the checkbox array? I am using t

avatar
Dorinda
0 1 0 9
asked 07 September, 2021
52 votes
13 answers
658 views
How to change the href attribute for a hyperlink using jQuery

How can you change the href attribute (link target) for a hyperlink using jQuery?

avatar
Louetta
0 1 0 9
asked 07 September, 2021
52 votes
14 answers
3K views
How can I select an element by name with jQuery?

I have a table column I’m trying to expand and hide. jQuery seems to hide the <td> elements when I sel

avatar
Vi
0 1 0 9
asked 07 September, 2021
60 votes
30 answers
1.8K views
What is the best way to add options to a select from a JavaScript object with jQuery?

What is the best method for adding options to a <select> from a JavaScript object using jQuery? I'

avatar
Yolando
0 1 0 9
asked 07 September, 2021
48 votes
30 answers
2.1K views
How to manage a redirect request after a jQuery Ajax call

I'm using $.post() to call a servlet using Ajax and then using the resulting HTML fragment to replace a d

avatar
Tuan
0 1 0 9
asked 07 September, 2021