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

learn more… | top users | synonyms

3
votes
1answer
36 views

Best practice for generating jQuery dynamical content

I am new user of CodeIgniter and I am trying to build an application that there are lots of jQuery dynamical content. Below I provide a code that I am using in order to be precise. The code below is ...
3
votes
0answers
39 views

Tooltip plugin for portfolio website

I am writing my own tooltip plugin for my portfolio website that I am currently working on. So far I have this code below. It works rather well however I feel that there is a lot I could improve. ...
4
votes
2answers
46 views

jQuery wrapper of Parsley.js

In a project, I have a lot of HTML forms without validation and I want to add a front end validation, in a quick way. I start looking for a library and I met Parsley.js. It's a good library, but if I ...
8
votes
2answers
81 views

Can this secure, random generator be improved?

This random generator uses cryptographically secure numbers/chars instead of Math.random(). The Javascript code with jQuery works well but I affect clean code ;) It would be great if you could help me ...
5
votes
1answer
56 views

What are your opinions on these small scripts?

I am new to JavaScript, and I was wondering if anyone can share their opinions on what I have done below: First of all, the following functions are all placed in a file called main.js and that file ...
5
votes
1answer
137 views

Is there a shorter way to write this jQuery code?

I'm using two category filters from this demo. I give the filters two different sets of classes so they won't affect each other. Since I'm very new to jQuery, all I can come up with is repeating the ...
5
votes
1answer
123 views

Checking input and email field

I've written this as part of my contact form on my website. It checks to see if required inputs are empty, if so adds a red warning color and text. It also checks the email field for a properly ...
-1
votes
0answers
14 views

Jquery function bug - wordpress search button doesnt work [closed]

I'm not a coder and I'm just trying to learn some basics. I have a wordpress site with a search form but the button to click and get result, is not working. I had some problems with other plugins, ...
8
votes
1answer
69 views

Simple CoffeeScript navigation menu

I'm using simple script to handle tab menu like this: HTML: <nav id="personal"> <ul class="clearfix"> <li id="personal-info">Info</li> <li ...
0
votes
0answers
6 views

Create custom JSON object using jQuery [migrated]

I want to create a custom multilevel JSON object. For that I have written some code, but it's not solving my purpose, although I am still working on it. I need your suggestions to write the code. ...
5
votes
2answers
90 views

Injection with Chrome Extension

I am building a Chrome extension that injects a small overlay in to all websites using a content script. At this point all the injected elements do is sit in the bottom left corner. It has two buttons ...
16
votes
1answer
288 views

Random clothes generator

UPDATED, original code can be found here. Also, my main goal is to not only improve the style of my coding, but also to improve the logic in finding random combinations. As of now it seems way too ...
8
votes
2answers
198 views

Create news ticker animation

I have this function in this fiddle JavaScript: var newsTicker = function (ele) { var eles = ele.find('ul li'), indexEle = 0, dataEle = ele.find('.ticker-post'), ...
8
votes
2answers
67 views

Member list reveals member information on click (#1)

What I'm doing? I'm creating a member-list where initially only the names are visible. Clicking the names reveals the member information. This is done with jQuery by adding/removing classes. I left ...
2
votes
2answers
35 views

Simple registration form with Backbone

I am trying to create simple registration form with Backbone. I need to validate fields on blur, and whole form on submit. HTML: <form> <div><input name="name" type="text" ...
0
votes
1answer
34 views

Reducing multiple function calls [closed]

I can't quite figure out the best way to approach this. So I have a validation function that contains various other functions inside of it for validating email, phone and zip. This works fine but it ...
10
votes
3answers
144 views

MS Excel type of grid in jQuery

I have created a MS Excel type of grid in jQuery. I want to learn best practices and I need your comments for more optimized code. Please review the code and offer your suggestions. Demo jQuery: ...
3
votes
1answer
42 views

Checking for a value on selectors

I've got some pretty simple validation that I'm working on, but it seems like I'm repeating myself a bunch of times. There has to be a better way of doing this. I'm simply checking if there is a value ...
3
votes
2answers
112 views

Simplifying this form validation script - version 2

A week ago, I have asked how to simplify a form validation. From the answers, the code now is improved. Can anyone please share their opinion on the approach used below and advise me if there is a ...
5
votes
0answers
70 views

Memory leaks in jQuery code [closed]

I've got this open source jQueryUI widget, which leaks memory whenever the DOM node is removed: ;(function($){ 'use strict'; var pluginName = 'vanderlee.tristate', tristates = [], ...
10
votes
3answers
145 views

Ultimate Tic-Tac-Toe Challenge

This is my attempt at the Ultimate Tic-Tac-Toe code challenge. It uses jQuery to build out the game grid and find the states of all the "buttons" (actually <div>s) when calculating whether or ...
3
votes
2answers
49 views

Append table cells to select boxes in indexed order

I am having a huge brain fart with efficiency right now. The idea here is if I have a static table (unfortunately formatted this way with the data I've received), how would I appropriately append a ...
3
votes
0answers
27 views

knockout binding handler for custom components

I am using a combination of knockoutJS and jQuery. I have a number of jQuery plugins which perform particular re-usable functions, such as a numeric spinbox. I have written a binding handler to ...
6
votes
2answers
83 views

Simplifying this form validation script

Can anyone please help me to simplify this form validation script? It works great but I was just wondering if I can get some help to make it simpler. Your opinion on the approach I used below is ...
1
vote
1answer
76 views

Basic quiz in jQuery

I am using jQuery to implement a basic quiz functionality. How can I improve this code snippet even more? Is there any better way of doing it? I am using jQuery 1.6.4. /*jshint -W065 */ $(function ...
4
votes
1answer
121 views

Check if js variable exists and checking it's value

I feel like this bit of code could be condensed or made better in some way. It may in fact not be but figured I'd get some people smarter then me to have a look. I have multiple pages on my site and ...
1
vote
0answers
43 views

Loading youtube video inside a bootstrap modal

The following code loads a youtube video inside a iframe, where the tricky part is to sync the onYouTubeIframeAPIReady and on('shown.bs.modal') functions. The code works well in Firefox and decently ...
4
votes
1answer
66 views

Replace radio/checkbox plugin

I've just created my first plugin, but I think I've written too much bloated code. Could you point me to the right direction? $.fn.replaceme = function() { function add_essentials(element) { ...
2
votes
1answer
44 views

JQuery/AJAX registration

function reg(email, pass){ $.ajax({ url: "uman.php", type: "post", data:{email: email, password: pass}, success: ...
9
votes
2answers
72 views

Assigning width and height to specify image dimension using jQuery

After testing my site against GTMetrix, I get warnings on not specifying image dimensions. I am working on a WordPress site. Here is my solution: My first solution was: // Specify image ...
-1
votes
0answers
15 views

Change class for date in datepicker directive that is always visible [migrated]

I am new to angularJs and jQuery and have this problem I am trying to solve. I created a datepicker directive that is always visible. I have a list of changing dates, that I want to use to update the ...
2
votes
1answer
53 views

How to write efficient javascript/jQuery code involving loops and string concat?

I am using kendo grid's onDataBound event to do something. Here's my jQuery code: console.time('withoutnot'); jQuery(e.sender.dataSource._data).each(function (i, v) { if (v.IsReadonly) { ...
1
vote
0answers
32 views

Correct MVC in CodeIgniter

In my CodeIgniter I have a Login controller that load this view: <ul class="sub-menu"> <li> <a href="javascript:;" class = "menu-item" ...
5
votes
1answer
53 views

Hide the tree menu at a certain depth

I have created this piece of js purely for learning purposes and I was hoping you could code review to see any mistakes / improvements I can make. Basically I have a tree structure and I will use the ...
3
votes
3answers
54 views

Reducing conditionals if a selector exists

I've got a conditional that sets a cookie based on if a selector exists. There are other places in the code where I do something similar if the selector exists. If the selector exists I either add ...
7
votes
2answers
55 views

Can this code be cleaned? Multiple objects triggering different hover events

When the user visits the web page and hovers over an album artwork, the title of the piece and the artist name appears. It leaves when the mouse leaves. I have achieved this with the following code: ...
4
votes
1answer
58 views

jQuery click handlers

I'm working with Codeigniter and I have a jQuery file to add some functionalities. But I think I'm doing it in a wrong way. $(function() { var list = '../indoamericana/intranet/employeesList/'; ...
1
vote
0answers
31 views

Opening JQuery Dialog box onclick of dynamically created linkbuttons [closed]

I have created a blog. A specific group member can chat in that blog. Each comment has a dynamically created linkbutton ("edit"->text) Upon clicking on the edit linkbutton, I want a dialog box to pop ...
6
votes
1answer
41 views

Pass in parameters instead of multiple functions

I can't quite figure out the best way to approach this. I have two jQuery objects that both are used to set cookies. I then parse the JSON and set a cookie that is either the users height or the users ...
4
votes
1answer
46 views

javascript for controllers of multiple audio tags

I am trying to learn to create controllers for my own HTML5 audio tags, which I often have several of on the same page. The js.jQuery code below is a simple beginning to this; it works to apply a ...
7
votes
1answer
54 views

DRY multiple if statements used to show/hide elements based on slider value

I'm showing and hiding 4 svg paths based on the value of a slider, all is working as expected, but it still feels a little cumbersome. Does anyone know a way to "DRY" it out a little more? jsFiddle ...
6
votes
1answer
95 views

A package for the DOM

Concerned with the length of this and the organization. Looking to organize it better if possible. If anyone knows the jQuery equivalent of these methods I would like to put them in the comments. ...
6
votes
1answer
72 views

First “Revealing Module” implementation

I have a little js I call a "jqGrid Factory" to encapsulate common settings and functionality across my web app. I just want to see what improvements I can make. var jqGridReportFactory = (function ...
7
votes
1answer
103 views

A better looking 'treeview' - dealing with lots of checkboxes

I'm working on the ui for an application which uses a custom ui control that is loosly related to a treeview. This treeview has two levels: Top level which has a number of different geographical ...
4
votes
1answer
53 views

Dynamic toggle system

I'm new to jQuery/JSON and I've build an dynamic toggle system. It work fine, but I'm not sure about my code and I want a better way of building this. Could you please see my code and give ...
4
votes
1answer
95 views

Refactor jQuery code to use fewer selectors

At this point I've written a fair amount of code to deal with dynamic line items. I've slowly refactored most of the code into an Order object that's created at page load which contains the methods ...
5
votes
1answer
69 views

jQuery Fallback Support for the CSS Property “background-attachment: local”

I have made some jQuery Fallback Support for the CSS Property "background-attachment: local" and I am mainly a CSS developer. I do some jQuery, but I thought I would check to see if I am doing this in ...
1
vote
1answer
80 views

Changing html element with click event: how to restore default state of element using jQuery if/else statement

I have a click event that calls a function (below, txtResize) which makes some CSS changes to html text. (Acts on Text of 3 unique elements). Q: What is the best way to refactor this code to limit ...
4
votes
2answers
35 views

Changing text with a click event: how to restore default state of text in jQuery if/else statement

I have a click event that calls a function which makes some CSS changes (acts on Text in 3 unique text elements). The function (below) works, but is lacking a 'restore default' function (to return ...
3
votes
2answers
54 views

Find end of $.each() loop

I need to find the end of a loop or the length of the object. Some context on the code: I obtain the txt var from the DOM (that's the only way I've got by now and can't change it) and it's a ...