Tagged Questions
0
votes
2answers
15 views
Making the save and cancel buttons editable
The following code makes a div tag editable and handles the save and cancel buttons. But there is a lot of duplication. How could I remove the duplication on this?
...
3
votes
4answers
776 views
2
votes
1answer
38 views
Simple text toggling
I made a simple AngularJS text function. The purpose is to provide an array of content to display. A 'slider' will be made with next and previous buttons that hide on the last and first slide, ...
2
votes
0answers
18 views
Homemade Lightbox and Image Gallery
I'm new to JavaScript, and I've built a lightbox for an image gallery. There's a button to open the gallery, plus forwards, backwards, and close buttons, and keyboard controls. Currently, everything ...
0
votes
0answers
19 views
Only able to zoom the first or the last image on the slideshow [on hold]
First of all, I am sorry if I have to move this question here, considering that in stackoverflow it still dons't have any answer yet since yesterday.
HERE IS THE DEMO
I have an images slideshow ...
4
votes
2answers
51 views
Conditional Branching Using Filter
I'm using multiple jQuery filter functions to affect the background color of select objects based on the selected option and it works, but it seems bulky/redundant. Does anyone know how these filter ...
5
votes
3answers
67 views
DRYing out a basic image slider
I built a very basic image slider, but I'm still having trouble refactoring.
I caught myself reusing same code for clicking the previous/next buttons, selecting a slider dot, and the automated ...
2
votes
0answers
37 views
Refactoring JavaScript functions that differentiate only by condition and return value [closed]
Currently I have 3 functions which are really similar. They differentiate only in input parameter name, condition and return value.
I'm going to refactor them, and I thought you guys might tell me ...
3
votes
1answer
41 views
Can this date-validation function can be simplified further or is it the correct approach?
I am doing a date validation. I have no. of pages, which have the date field. User can input the date like "220875" or "22AUG75" - I need to test both and check the length as well.
...
5
votes
2answers
66 views
Small jQuery mobile plugin to handle touch events
Why this plugin:
I am developing a mobile app - at some point, I felt like this would be a good idea to give the users the possibility to control everything in the app with touch gestures, hence the ...
4
votes
1answer
38 views
Multiple drop down validation
I have written some jQuery which validates a group of drop downs. It checks the text value selected in all the drop downs (first three characters), and if there is a duplicate, it warns the user.
...
3
votes
1answer
42 views
Send parameter to server and reload page
My first ASP.NET MVC 6 / jQuery web site - the site header has a "Change Language" selector (named LanguagePicker) - this is actually placed in a _Layout view, a ...
2
votes
1answer
75 views
JavaScript eBay Listing Generator
I'm still pretty new at JS and, frankly, this is probably a little above my skill level. But here's my attempt at a script that will take user input and produce a custom interactive eBay listing.
...
1
vote
1answer
51 views
Better way to write 'bulky' function in jQuery
I have this function that works fine, but it looks really ugly and repetitive...
Basically I have a featured profile and underneath I have 4 smaller thumbnails, on click I want to populate the large ...
1
vote
1answer
42 views
3
votes
1answer
44 views
Activating image and video carousels
I am using this jQuery code to get two carousels working in bootstrap, and it's working for me.
...
0
votes
0answers
36 views
gallery.js with next/prev navigation and swipe function
This is a simple gallery script which I’m using in my website.
The script is loaded in the body. (Everytime the user clicks a navigation-link to some page with a gallery, it is loaded.)
I thought ...
3
votes
1answer
73 views
Can this form validation be simplified made to memory leak free for all browsers?
I am doing a validation and I believe that there are many things that can be reduced or removed. I am still re-working this. But I am looking for some experts to look at my code and offer the very ...
0
votes
1answer
45 views
Checking number of of columns in a row
I have a own made grid system and made a jQuery function for that to check if there are not too many columns in each row. If so, ...
2
votes
1answer
52 views
Simplifying AJAX success code
Please take a look at this Fiddle.
Is there a better way of building a table with titles in the first cell of each row, like this:
...
0
votes
0answers
20 views
What would be a better way to add a table to another table?
I was coding a plugin when I've noticed that there was probably a better way of writing this.
...
0
votes
1answer
42 views
Getting data from the server via JSON callback and parsing the data to HTML
I'm pretty new to web development with JS and was wondering if anyone can tell me how I can improve my code. I just feel like when it comes to maintainability my code would be very difficult to ...
3
votes
3answers
82 views
Optimize jQuery selectors code
I have this fiddle http://jsfiddle.net/L7zuT/ where I'm working on a small part of a big event program. The functionality is ok, the part of the problem would be the large JavaScript lines needed with ...
2
votes
1answer
38 views
Writing my own jQuery plugin
I am trying to write a jQuery Plugin from a piece of JS code I had written. What this plugin does is it converts a select box into a map of Australia where I can select individual states. It's ...
3
votes
1answer
36 views
Personal Project for managing my Bookmarks - v2
I had asked earlier for review of parts of my JS file earlier and review of the complete JS file of my project. Now I have made changes as per the suggestions. Here are the files. I would like to get ...
2
votes
1answer
73 views
Refactoring a Instagram widget feed function
I've adapted a Instagram widget from this example so that it now appends 8 images to their respective IDs using a Instagram username. I want my widget implementation to be better and more efficient. ...
2
votes
2answers
93 views
Creating a function when user clicks on element to toggle another element
I use a lot of "when user clicks on element then another element will be displayed as visible/hidden... aka toggle".
So I'm trying to make a general function to abide the DRY principal.
Before ...
4
votes
1answer
69 views
Object Oriented vs Not jQuery & JS
I have taken a widget/ plugin that I wrote yesterday and just now it has been re-written in an object oriented format. It is certainly more code to write it the OO way, so please let me know also how ...
2
votes
1answer
131 views
Enabling/Disabling button on a certain condition
I am using a Telerik Datetime control. On onBlur event of input box I am checking if the date is valid/in-valid, based upon that ...
1
vote
0answers
44 views
JavaScript parameters - best practices for settings object/callback
I have the following function which runs as expected and is defined in the window object:
...
2
votes
1answer
42 views
Which mouseover handler is better?
I'm currently learning some jQuery and I am stuck on something. On a small exercise I did, I was asked to perform an action when you mouseover a div class. I gave a different solution than the one ...
4
votes
1answer
72 views
Personal project for managing my bookmarks
I am working on a personal project for managing my bookmarks, which is basically a web page to manage my bookmarks by categories. Managing here means everything - adding, viewing, updating, searching ...
7
votes
2answers
159 views
Cleanup code to add div structure to element
I was cleaning up my code when I came across this situation :
...
2
votes
1answer
64 views
Adding, deleting elements as per autocomplete results - updated
I am working on a Python/Django project which has turned into a JavaScript/jQuery project due to the amount of asynchronous functionality that I thought to add.
There is a JavaScript file which is ...
4
votes
1answer
58 views
Driver License Input Form
I am willing to switch to OOP concept, but before working on that I would like to know whether what I have working so far is OK, or if any major change is required?
For every form I create 3 files:
...
0
votes
0answers
43 views
Efficient way to reduce jquery code
I'm working on an application that has some repeating code. Wheneven I try to reduce this code it breaks.
For example this code is repeating itself
...
7
votes
7answers
781 views
DRY-ing jQuery code for portfolio site
I'm currently working on my portfolio site and it's all great, but I'm unsure how to DRY my jQuery. I'm repeating myself a lot in the jQuery and it's just messy.
HTML:
...
4
votes
3answers
92 views
Is it possible to condense and/or tidy these jQuery functions?
Here is a JSFiddle of my problem.
I have one <select> on the page that lets you choose a brand:
...
3
votes
1answer
44 views
How do I generalize method which use Deferreds?
I've two similar functions and I want to use one generic function with two params, dialog and buttons. How do I do it?
My ...
3
votes
1answer
82 views
Is this code efficient for multiple file uploads in jQuery?
I have this code which works for uploading multiple files (images), however, it seems inefficient due to having to a function for every single file upload (for 2 uploads but there will be about 12 in ...
2
votes
1answer
53 views
Refining/simplifying jquery for hiding and showing fieldsets
I'm starting to figure out this jquery stuff, but as you can see there's a long ways to go. How would I approach refining and simplifying this snippet. Its purpose is to show a fieldset...
4
votes
1answer
131 views
Are my filter functions DRY enough?
Here's a function I wrote - am I getting DRY about right? I could add another argument to paramFilter maybe, for even less reuse. Or have I gone too overboard as it ...
3
votes
3answers
103 views
Nested If-else condition optimization
I need some help in optimizing this block of code. It looks dirty right now.
The following function checks if the EndDate of my grid is valid or not. If it is not valid it turns the bgcolor of the ...
1
vote
0answers
33 views
Bind and unbind clickoutside event
I have a jQuery dialog that is opened when the content of a div is clicked.
When the dialog is opened, I am binding a jQuery outside event so when the user clicks anywhere outside of the dialog the ...
2
votes
2answers
78 views
5
votes
2answers
115 views
Correct way to extend Bootstrap Modal - lock, unlock
I'm trying to extend bootstrap 3 modal window with ability to disable closing it.
I've built this code:
...
4
votes
2answers
62 views
Initializing events on class
I wrote a simple class that substitutes all file inputs in an HTML for a more complex template and set some actions on it. The code is rather small, but I'm not used to write JavaScript.
I wonder if ...
5
votes
3answers
316 views
Regex match for a string in a URL
I feel like there is too much repetitive code going on here. All I am doing is doing a basic regex match for a string in the URL. If a match is found, I find an li with a class (.index, .grid, .type) ...
2
votes
0answers
142 views
jQuery animate opacity, fade, & slide up page load effect
This is the first time I've actually made my own jQuery script from scratch, because I couldn't find exactly what I was looking for. My code works how I want it to, although I don't know if I did it ...
1
vote
0answers
56 views
Adding, deleting elements as per autocomplete results
I am working on a bookmarker project for replacing storage of bookmarks in webbrowser. It will be storing bookmarks as per categories in a database. I have written some jQuery for the WIP search page. ...