Tag: javascript

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
58 votes
21 answers
2.7K views
Where should I put <script> tags in HTML markup?

When embedding JavaScript in an HTML document, where is the proper place to put the <script> tags and in

avatar
Dorian
0 1 0 9
asked 07 September, 2021
57 votes
30 answers
1.7K views
Convert form data to JavaScript object with jQuery

How do I convert all elements of my form to a JavaScript object? I'd like to have some way of automatic

avatar
Percy
0 1 0 9
asked 07 September, 2021
48 votes
30 answers
2.3K views
What is the best way to detect a mobile device?

Is there a way to detect whether or not a user is using a mobile device in jQuery? Something similar to the CS

avatar
Dorian
0 1 0 9
asked 07 September, 2021
53 votes
15 answers
1.1K views
How to move an element into another element?

I would like to move one DIV element inside another. For example, I want to move this (including all children)

avatar
Bryan
0 1 0 9
asked 07 September, 2021
53 votes
28 answers
760 views
Preview an image before it is uploaded

I want to be able to preview a file (image) before it is uploaded. The preview action should be executed all

avatar
Dusty
0 1 0 9
asked 07 September, 2021
61 votes
18 answers
1.3K views
Abort Ajax requests using jQuery

Is it possible that using jQuery, I cancel/abort an Ajax request that I have not yet received the response fro

avatar
Roger
0 1 0 9
asked 07 September, 2021
65 votes
30 answers
1.8K views
Get current URL with jQuery?

I am using jQuery. How do I get the path of the current URL and assign it to a variable? Example URL: http:/

avatar
Georgie
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
1.3K views
$(document).ready equivalent without jQuery

I have a script that uses $(document).ready, but it doesn't use anything else from jQuery. I'd like

avatar
Freida
0 1 0 9
asked 07 September, 2021
55 votes
20 answers
2.2K views
Get the size of the screen, current web page and browser window

How can I get windowWidth, windowHeight, pageWidth, pageHeight, screenWidth, screenHeight, pageX, pageY, scree

avatar
Tana
0 1 0 9
asked 07 September, 2021
58 votes
19 answers
1.7K views
How to get the children of the $(this) selector?

I have a layout similar to this: <div id="..."><img src="..."></div> and would like to us

avatar
Adolfo
0 1 0 9
asked 07 September, 2021
58 votes
30 answers
1K views
How can I determine if a variable is &apos;undefined&apos; or &apos;null&apos;?

How do I determine if variable is undefined or null? My code is as follows: var EmpName = $("div#esd-names d

avatar
Hilario
0 1 0 9
asked 07 September, 2021
63 votes
30 answers
1.5K views
Get selected text from a drop-down list (select box) using jQuery

How can I get the selected text (not the selected value) from a drop-down list in jQuery?

avatar
Wilfredo
0 1 0 9
asked 07 September, 2021