Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [javascript]

ECMAScript or ES (commonly referred to as JavaScript) is primarily used for scripting web-pages but also has several embedded forms as stand-alone interpreters or JIT compilers. Use this tag for questions regarding all versions of ES up to the current ES8 and its dialects / implementations: JavaScript, JScript, etc., excluding ActionScript.

2
votes
5answers
2k views

How bad is this jQuery? [closed]

$($(this).parent().parent().parent().parent().parent().parent().children()[0]).html()
4
votes
3answers
267 views

Cycling between element above and below current array element

The title sucks, but it's really very simple - given an array and a starting element, cycle between one element above, below, then two element above, and below the starting element. For example: <...
8
votes
2answers
5k views

Animations with vanilla JS

I've used jQuery for a long time, and now I'm going to do some animations with vanilla JS. Here's my code so far: ...
15
votes
3answers
700 views

Displaying RSS feeds from Google Feed API as HTML list

What it does is: Reads from a RSS feed using Google Feed API Shows the list in an unordered list How good/bad is the code snippet? ...
8
votes
3answers
473 views

Demo of advertisment website

A fully functional demo URL: http://69.24.73.172/demos/index.html Note that in FireFox there is a small horizontal scrollbar bug which I have fixed at home. HTML: ...
10
votes
2answers
186 views

Separating and organising modules with objects?

As I'm creating a 3D Tic-Tac-Toe game, I'm having several modules inside my JavaScript application. For example, there is a 3D module which handles perspective calculations, whereas a Multiplayer ...
7
votes
2answers
284 views

JavaScript portion of regexp tester

I'm quite new to JavaScript, and I'd like a review of the code structure and syntax. It serves this little online regexp test (still a work in progress). The whole code (JavaScript, CSS & HTML) ...
8
votes
1answer
190 views

Generating readable text in a human language from machine-readable data

I have been generating English-language text from some machine-readable data, but now I want internationalization of my script to be relatively easy. The challenge is that some data might be missing ...
8
votes
1answer
564 views

Processing an API's JSON response

I am using the JSON output of the MediaWiki API documented here and here, and I have found that for Boolean values, it often returns an empty string if true and omits it if false. Thus, I want to "...
4
votes
1answer
527 views

Creating a tab plugin

I am creating a tab plugin. I want to know if there is a better way of doing this or if what I have is good. It works just fine, but there may be some shortcuts or a more optimized way of ...
9
votes
3answers
2k views

Is there a better way to output a javascript array from ASP.net?

I often run into the problem of producing a javascript array on an ASP.net page from an IEnumerable and I was wondering if there was an easier or clearer way to do it than ...
11
votes
1answer
639 views

String interpolation library

I was bored over the last couple of days and wrote up a string interpolation library for JavaScript. I'm very pleased with its functionality, it passes it 79 tests cross browser and the comments and ...
20
votes
1answer
453 views

Unit-testing function

I've got this javascript function which was written a bit ad-hoc and I'm not really sure how to go about refactoring and improving it. It's basically an implementation of draft Unit-Testing/1.1 ...
13
votes
2answers
1k views

Clickable icon for expanding/collapsing content

The general idea of the code is that I have a + or - icon (".trigger") that is click-able ...
8
votes
1answer
3k views

Looking for improvements on my jQuery-UI tagging widget

I am looking for any possible improvements on this tagging widget. I ask for special attention to be paid to my blur handler in the event of a autocomplete option being specified but any ...
5
votes
1answer
828 views

Branch-and-bound based IP solver

I've written this rather naïve branch-and-bound based IP solver. Are there any obvious JavaScript optimisations that could speed it up? I am not looking for asymptotically better algorithms, just ...
2
votes
1answer
290 views

Do I need to use a callback function here, or is there another way?

Here is the pertinent code: index.html ...
6
votes
2answers
557 views

Basic form validation

Question + Desired Outcome The code below works currently, however I'm not convinced the utilisation of an Array to iterate through numerous non-existent form ...
5
votes
2answers
3k views

Do I always have to return something in an anonymous function?

I have inherited this snippet of jQuery JavaScript and am currently brushing up on my jQuery. NetBeans IDE complains that ...
8
votes
2answers
310 views

Theme/skin swap… version 2! (CSS-driven)

I basically have an AJAX-fetched skin (html/css) that's loaded into a dummy element (id=SkinContainer) when the page is loaded, and then the content of one of its divs (contentdiv) is fetched with ...
4
votes
2answers
723 views

Making sure all elements are processed in a JQuery call

I have a piece code similar to below: But I keep having this nagging feeling that there has to be an easier way! Any ideas? ...
8
votes
3answers
453 views

Basic JavaScript library

My own CMS is currently using jQuery, but as one of the goals is to have the whole project to be very small, I've decided to write my own basic library. I only really need to select elements and ...
22
votes
1answer
1k views

Dynamically generating a list of events

This is a simple list of items in a list, which allows the user to dynamically generate that list of events. Then a controller action does the work of serializing that into the database. The issue is ...
26
votes
3answers
10k views

Usage of the ternary “?:” operator with functions listening to click events

I've recently been doing some mods to some old code I've been maintaining for a couple of years now. As part of a wider set of scripts using YAHOO YUI 2.2 (yes, that old) for dialog-style panels, I ...
5
votes
2answers
417 views

Need a feedback on my Javascript code and app implementation idea

I'm new into Javascript, and I'm not sure that is a good approach. The code works, and does what I need it to do but I'm sure I didn't do the things the right way. Can you give me feedback about the ...
12
votes
2answers
3k views

Simple star rating system

I'm working on a simple star rating system, and before I move on to actually "tallying" the votes, which I figure I'll just do with $.ajax, I wanted to make sure ...
3
votes
1answer
669 views

Skin/theme swap

Theme-swap functionality will be done via a better-looking <div> at the top of the page, but for right now, it's just thrown on the button. The theme ...
5
votes
3answers
481 views

Javascript Object Placement / String Parsing Method

This JS function is intended to retrieve or place a value into an object with the nested keys as a string. For example ...
7
votes
1answer
699 views

Build menu from MS Word XML

I've recently assembled some jQuery that allows a user to build out a bulleted list in MS Word with hyperlinks and turn that into a HTML unordered list. Ideas for uses are website menu systems where ...
12
votes
1answer
2k views

ExtJS Grid Plugin

The code below is a plugin I wrote for Ext.grid.GridPanel, which basically allows you to have a bit more control over how rows are striped in the grid. By default ...
15
votes
3answers
998 views

Using a navigation menu to help keep material organized

I'm working on a personal project to keep different snippets/examples/small projects of mine organized. I want to make the most of my page width, so I decided to write a navigation menu that slides ...
19
votes
2answers
748 views

Cleaning up class creation / extension

I was wondering for quite some time how to clean up the below code without blowing it up any further. The extension of the classes is the main concern here, it looks a bit too much like magic. That's ...
7
votes
2answers
456 views

Pagination plugin

This plugin is written in jQuery and is made to support the codeigniter framework. It is an ajax powered table pagination plugin designed to provide only that. You should be able to use almost any ...
26
votes
1answer
373 views

Managing network address information

I'm a developer at a networking company that really has no peers that work above me that I can use for any sort of sounding board for my code, so it's just me. I was wondering if anyone would be ...
11
votes
3answers
383 views

More elegant way to show | hide in jQuery

What is the best way to optimize this jQuery code? ...