All Questions

Tagged with
Filter by
Sorted by
Tagged with
3
votes
0answers
35 views

Displaying sections from pre-checked options

First off, not the greatest with jQuery but know enough to get by. I have a custom script for our WordPress site that ties in with a main plugin we use. I have a JSFiddle that gives the gist of what ...
2
votes
2answers
43 views

Find size for elements to fit in certain width

This is a follow-up on Change size of elements until parent reaches certain height The goal of the function is to find a size for the elements inside a parent, so they all fit in a single row. I ...
0
votes
1answer
27 views

Jquery Selector optimization for multiple clicks

I have multiple inputs that each one has an increment and decrement button The buttons will be pressed multiple times so i am looking to optimize my selector: So should i keep the first one (which ...
4
votes
1answer
96 views

Video player UI in Javascript/JQuery

I am a Javascript/JQuery beginner working on my first ever project. Everything in this program is working as it should and I am happy with its performance. I have pieced it together from a variety of ...
2
votes
1answer
52 views

Add or remove a class on two elements when two different events fire

I want to add/remove a class on the html and body tags in the dom when my nav menu is opened or closed. Is this the most optimal way of writing this logic? ...
1
vote
1answer
44 views

JQuery Selector in Vanilla JS

I've decided to reproduce the JQuery selector - specifically for finding elements by class name, ID, and tag So for example the tests could be written like ...
3
votes
2answers
106 views

jQuery dynamic toggle class function

I wrote this function that will toggle a class of a targeted element. Applying the class js_class_toggle to any element will trigger the function when clicking on ...
2
votes
2answers
48 views

jQuery redirect form

I'm using jQuery to create a (hidden) form that redirects people to another page using JavaScript. ...
-2
votes
1answer
42 views

Show maximum 4 forms on user actions [closed]

HTML ...
1
vote
3answers
99 views
0
votes
1answer
164 views

JavaScript Tic-Tac-Toe

The first function makes 2 players ...
1
vote
1answer
188 views

A simple jQuery function that removes empty or tags containing just ' '

I've made a simple function, this time in jQuery rather than JS, that just removes empty <p></p>, span and strong tags. I'm curious to see what everyone ...
3
votes
2answers
86 views

Displaying information extracted from an HTML table

This function below (used on a timeout due to my page loading time) displays information on my site. I grab this data from my table view that I load into the page. It is launched by clicking a button ...
2
votes
2answers
60 views

Replace string of class of button by class so that only one button is filled in using bootstrap buttons

I'm using bootstrap buttons, and in this case I have 5 different buttons with 5 different classes. When one of the buttons is clicked on, I want it to be the only one filled in, and the others to only ...
3
votes
1answer
66 views

jQuery plugin to load a full-page view window

I am writing a lot of jQuery plugins lately, but I don't really know if what I am doing is any good. Here is one of my most recent plugins, this allows you to add a data attribute to any class and ...
3
votes
2answers
60 views

jQuery handler to update map UI based on AJAX response

I am working on a university project that consists of creating a map application with openlayers as well as the necessary User-Interface. I am using jQuery, native JavaScript, PHP and of course HTML/...
2
votes
2answers
91 views

Manipulating the browser history

I created a table with the ability to edit with popup. This part of the code, which includes: the ability to send URL to other users with the subsequent opening of the same state (the popup window ...
2
votes
1answer
980 views

Create multiple parametherized JQueryUI dialog boxes

In my application, I am using a lot of jQueryUI dialog boxes. In order to reduce the length of code, and because I am using often the very same parameterization, I was wondering about a way to ...
2
votes
0answers
36 views

Remove General sibling on Keyup

I am creating a search filter using jQuery and implementing Array.prototype.filter(). What I have done is that I call the ...
4
votes
1answer
756 views

Simple application for the game “Mad Lib”

It is an application for the game "Mad Lib". I decided to use bootstrap modal for the questions. Mad libs are a simple game where you create a story template with blanks for words. You, or another ...
2
votes
2answers
603 views

Get JSON script code with pushing to heatmap

I have a script that makes a database call and then filters the results. After filtering it pushes it to an array and shows it on a map. Here is my function: ...
6
votes
2answers
1k views

Platformer without canvas

Well I had a idea about making a platformer but wanted to challenge myself to doing it without using canvas. It uses some other codes from github for collision detection. Here is the result. <...
2
votes
1answer
90 views

Propagating table cell border colors to adjoining cells

I have a JavaScript function (which uses the jQuery library but that should not be relevant here) that takes as input an ID (integer), a color, and a side (all, top, right, bottom, or left). For each ...
2
votes
2answers
116 views

jQuery Tab Scroller

I've never had anyone review my code. I actually found full-time work as a web developer and in the interest of ensuring that I'm always improving, I'd like to see if I'm doing things the proper way. ...
2
votes
1answer
136 views

Hotel search engine UI

I ask for your help to improve the form I created, keeping in mind that I am not a great expert in JavaScript programming. I need to create a hotel search engine, with the possibility to choose the ...
1
vote
5answers
3k views

Add and remove classes on resize

I'm just a bit confused and can not write or simplify a jQuery code, that adds or removes classes based on the viewport size. I'm pretty sure there's a simpler and more efficient way to write that ...
1
vote
1answer
98 views

Making a slideshow in JavaScript/jQuery

I am new to JavaScript and jQuery, and I would like to know what can be improved of the code in this slideshow. ...
0
votes
3answers
374 views

jQuery function to create a container div with some content

I just recently started with Javascript and jQuery. My background is in Python. I would be more than happy to get some feedback if this coding style of mine is optimal, or if in JS people generally ...
0
votes
1answer
31 views

Dynamically resizing panels based on browser window size

I've just finished building my responsive carousel currently trying to optimize my code to make it more efficient. I've created a number of if conditions in my ...
2
votes
1answer
52 views

DOM-Manipulating extension for grade calculation

I'm currently working on a Chrome Extension that uses jQuery to traverse and manipulate the DOM in order to read and write hypothetical grade calculations to a gradebook page. I already have a GitHub ...
3
votes
2answers
7k views

Getting images and saving them to localstorage

The code in this project accepts an image URL and creates an <img> tag dynamically, using the image URL as the src attribute value. The image *name *and URL ...
4
votes
2answers
132 views

JavaScript component to display ephemeral notifications

I would like to improve my code and organization of JS files so I'm wondering if you guys could tell me what I could do better. I've included a small but typical example of how I often use components. ...
3
votes
1answer
9k views

jQuery code to total the items in a shopping cart

I implemented a shopping cart with asp.net and jquery on my website, and here is my js code which calculates amount and total sum on client side: ...
1
vote
1answer
67 views

Objects using jQuery to maintain a playlist of shows

This is my first attempt at using OOP JavaScript in my work. I know the concepts but implementation is more complicated than I thought. Now the code is a mixture of several things (JavaScript/jQuery). ...
2
votes
2answers
72 views

Enabling or disabling buttons on certain events

I need to run the following checks in two occasions: When a certain modal is first shown or clicked, When one of two inputs is filled. How can I remove redundancy in the following code? ...
2
votes
1answer
469 views

Simulated chat bot

I am creating a very basic simulated chat bot/dialogue tree. I have the whole conversation mapped based on what a user selects. However, I am doing this by storing all of the conversation in ...
5
votes
1answer
68 views

Building a table from the result of an AJAX call

I am looping through content coming from the database using an ajax call. Then I'm building a table using a for loop. Is there a faster way to build the table using the data from the database or is ...
1
vote
3answers
109 views

Ensure that all `h2` tags have a `span` inserted

I'm running these on page load to ensure that all h2 tags have a span inserted (it's a large WordPress site that needs to have ...
3
votes
3answers
35k views

Create multiple divs inside a containing div

The below function is used to create multiple content division elements (i.e. <div>) inside a containing <div>. The ...
0
votes
1answer
173 views

Extracting the SKU and description of products from an invoice by querying the DOM

I have a site where a person can buy something. This site is built on a platform that allows any person to build a site without coding knowledge. One of the features of this platform, is that after ...
5
votes
2answers
2k views

Making thousands of DOM elements draggable with JavaScript

This is a very simple implementation of dragging elements in html/js. I'm working on a web application that could have thousands of draggable elements on screen at any given time. Currently, this ...
2
votes
1answer
135 views

jQuery plugin to toggle truncated text

I have from a recommendation on my other question here: My other review post Developed a truncate plugin, and was wondering if you guys could help me improve it or see where I have gone wrong. ...
6
votes
1answer
106 views

Accessing a REST WebService and updating local HTML objects with Modular JS

I have this code I am doing to make my code modular js: ...
4
votes
1answer
44 views

Everything you might want to know about an element

I am working with a lot of DOM manipulation and need to know several values of an element to determine its position within the DOM and I have written the following to help scrape several of the bits ...
0
votes
1answer
79 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
1k 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
1answer
118 views

Generating HTML code dynamically with jQuery

I am doing a college project and I would like to write my jQuery code following best practices. The project involves using the jQuery .getJSON method to retrieve ...
2
votes
2answers
58 views

Tag dependence approach

I need to add class is_active to all div's when I click on <div id="all-tags"> and remove class if I click again. Only ...
3
votes
1answer
93 views

Editing HTML based on instructions in a data structure

My getExtend() function, which will be included via require.js, has two inputs and one output: HTML file content config object which determine how to update ...
5
votes
1answer
1k views

Renaming the iframe src attribute to facilitate lazy loading

I'm not great with javascript. I need some code to rename all iframe src attribute names to data-src, for a lazyload plugin to ...