a JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.

learn more… | top users | synonyms

0
votes
1answer
28 views

List and post tasks with jQuery

I've written the code below to display a list of tasks from a Flask API. The form and associated .ajax method post to the API, immediately appending the data to the list of tasks. The code is working, ...
0
votes
1answer
36 views

Wait for a “3rd party” element to be appended to the DOM

Let's say we're writing a user script which interacts with a 3rd party site we don't control. We want to open a menu, so we trigger a click on the button and then wait 10ms before accessing the menu (...
5
votes
1answer
84 views

Random quote generator from API

I have built a random machine generator website. It fetches the quotes from forismatic and has a button to get a new quote. When it gets a new quote, the website color changes. It also features a ...
2
votes
1answer
62 views

Displaying dynamic fields for Trac tickets

TLDR: Rendering is too slow when having lots of custom fields and rules. So I need help to improve this javascript code. #9606: Trac ticket about issue I have a trac 1.0.8 installed on a ubuntu ...
4
votes
1answer
71 views

Converting a Website Into a Single Page App

I want to convert my website into a single page app. This function does the trick: ...
5
votes
3answers
305 views

Button click handlers for a JavaScript text-based adventure game

I'm pretty new to JavaScript, and I'm trying to created a text-based game. I've written a few scenarios and based on the player's decision I have different scenarios written out. As of now I have the ...
3
votes
0answers
17 views

jQuery modal dialog plugin

I'm working on creating a new jQuery modal plugin. I'm pretty good at jQuery but still pretty new to the whole object oriented plug-and-play style of plugins so I used a different plugin I found ...
-1
votes
0answers
18 views

How to get specific value from jsp looping table to jquery and send to servlet? [closed]

I have the problem when I wanted to return certain value and submit the form when I clicked on the specific button in the table. For example: I want to the get the value of acc.getID = 5 when I ...
0
votes
2answers
72 views

Looping over an array using $.each

The code below contains an array of objects that I loop over and append to hidden input fields in the DOM. As these inputs have no ID, I first select them by name using ...
1
vote
2answers
73 views

HTML structure for a wedding website using FullPage.js

I am fairly new to coding and currently trying to write as much as I can get my hands on. I started off playing around with templates but now I've decided to go without and therefore I am sure there ...
4
votes
1answer
74 views

Javascript contact form validation code

I'm a UI / UX Designer trying to sharpen my JS skills. I wanted someone else to check this code snippet and maybe have a Pro tip to improve or shorten it. Javascript: ...
1
vote
1answer
64 views

Which jQuery click solution is better? [closed]

I am here at my workplace, and we have a very passionate debate with my colleague about $().click() method vs onclick. I will ...
0
votes
1answer
66 views

JavaScript DOM modification

I'm thinking about DOM modification performance. In a perfect way, we alter each element but DOM modification is really heavy and alter many elements at same time froze the browser. I didn't make any ...
7
votes
2answers
55 views

Contra - 30 More Lives

Just for the fun of it, I wanted to have a hidden keypress function on my website that performs an event when the user types in the Contra code for thirty lives. I'...
1
vote
1answer
49 views

Interpreting the time

EDIT: Alternate answer on overflow: http://stackoverflow.com/questions/38487692/how-can-i-interpret-the-time-with-less-code/38492144#38492144 But I really want to keep Jonah's answer here too. Just ...
11
votes
4answers
852 views

Gallery of employees with dynamic filtering

I'm trying to learn how to write better, more efficient JavaScript code and wanted to run this function I'd written by you and see if people can suggest an improved method. It's basically a people ...
7
votes
1answer
111 views

Make Simultaneous HTTP Requests That Resolve Into a Single Return

This week, in an ongoing job search, I was tasked with the following pre-screening question: Make two simultaneous http requests. Use the language and library of your choice. Make sure the results ...
1
vote
1answer
48 views

Countdown module that hides an element when a specified date is reached

I have the following piece of code which hides an element when a specified date was reached. I would like to get some tips about do's and don'ts. Specifically, I'm interested in: improvements ...
4
votes
2answers
66 views

jQuery functions to add corresponding entries of lists

Thanks to this post, I was able to create a working piece of javascript that fits my needs. I have a div/ul/li based table where each "row" has 2 values that I want to have the sum for. Currently the ...
4
votes
1answer
63 views

Tic Tac Toe game made using jQuery and JavaScript

I have created a simple Tic Tac Toe game using JavaScript and using jQuery. I have used bootstrap for the UI. I am just a beginner, so some feedback on the JavaScript element would be great. <...
3
votes
1answer
64 views

Google Analytics tracking for HTML 5 video player

The jQuery code is for html5 video event GA tracking and I want to make it a little bit more shorter and cleaner. The code works: I am getting all the events, but would like to make it more simple. <...
1
vote
1answer
38 views

Popup jQuery plugin

I need a code review for my first jQuery plugin. It seems like a lot of code and I want to hear something about my plugin code structure and more. ...
2
votes
1answer
23 views

String building attribute selectors

I'm dynamically selecting elements in jQuery, how can I make it more resilient? $('[data-example="' + exampleData + '"]').each(...); I'm concerned that the data ...
3
votes
1answer
85 views

Simple jQuery photo slider

I'm fairly new to front end web development, but finally felt confident enough to create my own jQuery slider. I wish to receive constructive criticism about my code, how I can optimize any line of ...
0
votes
1answer
36 views

Vote-switching optimization

I have 2 <label>s being used for displaying the votes, which is up votes and down votes. There is no problem for the adding or removing votes, but the ...
5
votes
3answers
146 views

Changing color on button click

I have an html button that when the user clicks the button it will change color from blue to red and back. Is there a better way to do this in jQuery? HTML/jQuery ...
1
vote
1answer
57 views

Loading details of a list of cars

I have a tree view with a list of cars and a webservice to get the details for each car. On page load, there are no cars selected so the details footer is loaded with all cars. ...
4
votes
0answers
71 views

Colour-matching game

This is a game about matching the right colour. In the first level you start with 3 cubes that each have a different colour. After 2 seconds the colours of the cubes disappear and the cubes become ...
1
vote
3answers
63 views

Toggling image sources

I have a set of images with class = tt like so: <img src="images/arc_unselected.png" title="Arc" class="tt" /> and I ...
6
votes
1answer
171 views

Phishing application God class

This project is ultimately my senior thesis to graduate from college. It will end up being very long with several code reviews and redesigns. The next rubberduck perhaps? I've been working on a ...
2
votes
2answers
44 views

Retrieve data from json file and avoid HTML/JS tight coupling

I am retrieving data from a json object and even though code works I am not sure if I am following best practices. In particular some of the objects seems too deep (like value.metadata.connections....
1
vote
1answer
43 views

Loading an animation with an Ajax request

I am not sure if this is the correct way to make an Ajax request and do the typical loading/processing GIF/animation while processing is happening and displaying the response. HTML: ...
1
vote
1answer
25 views

Sidebar menu to hide or expand parts of a form

I have some of my code that I have tried to improve on to make it cleaner and efficient and I would like some feedback to see if I am going in the right direction with what I am trying to do. I have ...
1
vote
1answer
39 views

Event handler for conditions

I am trying to detect whether a condition is being returned true or false. The only problem is, I have a bunch of if/else ...
3
votes
0answers
71 views

Showing the slide named in the query string and hiding the others

I have this all figured out now thanks to the help of a mod. Here's the working code: ...
1
vote
0answers
40 views

JavaScript / jQuery Memory Guessing Game

I want some tips on how to make my code better, more efficient, better coding practices, etc. Codepen ...
6
votes
1answer
137 views

Simple restaurant menu

As stated in the title, the code produces a simple drop-down menu that allows you to select your Starter, Main and ...
0
votes
1answer
50 views

While focus on input check if empty

I made a small function that is getting looped when an input is getting focus and stopping the loop when the input is losing focus. Now I would like to know if there is a better way to write this code....
0
votes
4answers
21 views

Series of jQuery click events

I have the following series of click events in my jQuery code: ...
4
votes
0answers
33 views

Reading and updating an XML address file

I have some code that reads from an XML file and updates if needed. I want to move some of the stuff around. Here is the code overall: ...
0
votes
0answers
40 views

JS timer plugin

This code operates as intended, but with only with two operational timers running. I need the resize event in the match section as I need to retrieve the window ...
3
votes
3answers
78 views

Wikipedia Viewer

This is one of the projects on freecodecamp. I would like a review on my code. Thanks in advance. Javascript: ...
4
votes
1answer
67 views

A Game Of Simon

This is one of the projects from freeCodeCamp. It's a game of Simon (a memory game). I would like a review on my code. ...
3
votes
2answers
70 views

Javascript bar graph representation using CSS

This js was written strictly for a visualization of a graph redesign included in a stats report within our game systems. It all works properly, but I know there has to be a much neater way to organize ...
2
votes
2answers
47 views

Selecting one form to be visible using jQuery

I'm new to JQuery but have managed to get it working the way I want. The problem is, it's a bit convoluted and could easily get out of hand if I add more options. I am trying to show and hide divs ...
5
votes
2answers
151 views

My online hangman solver

I've created a simple hangman solver at solver.lukesalamone.com, and although I'd consider myself proficient in webdev I am by no means an expert. The trick with this is that since HTTP is stateless, ...
2
votes
1answer
44 views

jQuery menu state is-active

I have this menu in jQuery that works perfectly, but I think it would be better if, instead of using class="btn-accordion" for each ...
1
vote
0answers
27 views

Selecting up to three thumbnail images using jQuery

I have written something in jQuery but I'm not sure whether it is an elegant solution. Every click needs to check the DOM for classes/and add and remove classes. Any feedback or suggestions would be ...
4
votes
1answer
74 views

Javascript promises, multiple api calls in then()

This is the first time I'm trying to use promises in JavaScript so I'm not sure if I have done it correctly but it seems to work. The problem is that I have ended up with a "nested when" and it doesn'...
-3
votes
1answer
58 views

Simple code refactoring in javascript [closed]

This code is working but there's a lot of duplication, how can I refactor it ? ...