Skip to main content

Questions tagged [javascript]

JavaScript is primarily a language focused on web development. Being a monopoly on the front end and having Node on the back end. Use this tag for questions regarding vanilla JavaScript; optionally tagged with an ECMAScript version. If you are using a preprocessor such as TypeScript please tag with that too.

Filter by
Sorted by
Tagged with
6 votes
2 answers
418 views

Window-scrolling controller

I generally feel that the pattern I use for development is kind of wrong. I start with simple functionality, then when I realize that some pieces can be reused I usually start to write "scope root ...
Misha Reyzlin's user avatar
2 votes
5 answers
2k views

How bad is this jQuery? [closed]

$($(this).parent().parent().parent().parent().parent().parent().children()[0]).html()
Brandon Frohbieter's user avatar
5 votes
3 answers
293 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: <...
Yi Jiang's user avatar
  • 520
9 votes
2 answers
6k 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: ...
user avatar
16 votes
3 answers
787 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? ...
Shahriar's user avatar
  • 313
9 votes
3 answers
488 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: ...
Tom Gullen's user avatar
10 votes
2 answers
199 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 ...
pimvdb's user avatar
  • 225
7 votes
2 answers
297 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) ...
Florent2's user avatar
  • 173
8 votes
1 answer
236 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 ...
PleaseStand's user avatar
8 votes
1 answer
630 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 "...
PleaseStand's user avatar
6 votes
1 answer
548 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 ...
DDiVita's user avatar
  • 453
9 votes
3 answers
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 ...
stimms's user avatar
  • 325
11 votes
1 answer
684 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 ...
Ivo Wetzel's user avatar
20 votes
1 answer
484 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 ...
Raynos's user avatar
  • 1,129
14 votes
2 answers
2k 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 ...
jjnguy's user avatar
  • 661
8 votes
1 answer
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 ...
Hailwood's user avatar
  • 467
6 votes
1 answer
987 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 ...
Arne's user avatar
  • 63
2 votes
1 answer
304 views

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

Here is the pertinent code: index.html ...
Michael's user avatar
  • 323
6 votes
2 answers
624 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 ...
suitedupgeek's user avatar
6 votes
2 answers
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 ...
codecowboy's user avatar
8 votes
2 answers
331 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 ...
Michael's user avatar
  • 323
4 votes
2 answers
729 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? ...
Sydwell's user avatar
  • 143
8 votes
3 answers
477 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 ...
JamesM-SiteGen's user avatar
22 votes
1 answer
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 ...
Billy ONeal's user avatar
  • 1,460
24 votes
3 answers
13k 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 ...
LRE's user avatar
  • 2,169
6 votes
2 answers
438 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 ...
dole's user avatar
  • 163
14 votes
2 answers
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 ...
Andrew's user avatar
  • 463
4 votes
1 answer
721 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 ...
Michael's user avatar
  • 323
6 votes
3 answers
506 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 ...
Zack Bloom's user avatar
7 votes
1 answer
713 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 ...
Scott's user avatar
  • 663
13 votes
1 answer
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 ...
Mchl's user avatar
  • 528
17 votes
3 answers
1k 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 ...
Andrew's user avatar
  • 463
18 votes
2 answers
800 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 ...
Ivo Wetzel's user avatar
8 votes
2 answers
502 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 ...
Hailwood's user avatar
  • 467
31 votes
1 answer
457 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 ...
Kyle's user avatar
  • 549
12 votes
3 answers
457 views

More elegant way to show | hide in jQuery

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

1
186 187 188 189
190