Posts Tagged: JavaScript

Simple Combo Box jQuery plugin

I have just released simpleCombo, a jQuery-based combo box widget that is

  • simple
  • lightweight
  • consistent with native widget look and feel

You can try out some simpleCombo demos, and download simpleCombo from the simpleCombo project page at jquery.com. For more details, read on. Continue reading “Simple Combo Box jQuery plugin” →

Tooltips on disabled buttons with Dojo

Here’s how to add tooltips to disabled form controls using Dojo. The technique could be adapted for use in other frameworks or standalone JavaScript code.

I recently needed to add tooltips to a web application. The specific requirement was that when a button was disabled, there should be a tooltip explaining why. We were using Dojo 1.2. Now Dojo includes a Tooltip class, but it doesn’t work on disabled elements. Continue reading “Tooltips on disabled buttons with Dojo” →

Die QUIETLY!

Here is a piece of JavaScript code taken from a public commercial website. I have redacted some of the code to protect the guilty, but the rest is verbatim in all its glory. See if you can spot the error. Continue reading “Die QUIETLY!” →

elementReady: a jQuery plugin

I have written a simple but useful jQuery plugin. elementReady calls a function during page load as soon as a specific element is available — even before the full DOM is loaded. It’s useful if you have unobtrusive JavaScript that you want to apply to particular page elements immediately, without having to wait for the whole DOM to load in a large page. Continue reading “elementReady: a jQuery plugin” →

Share This (jQuery): a WordPress plugin

I have made a useful modification to Alex King’s excellent Share This WordPress plugin. Share This adds a nice popup to your posts allowing readers to easily submit the post to any number of social networking and news sites. The original version relies on the large Prototype JavaScript library, which adds to the download size for the page. Share This only uses a sprinkling of its features, so I wanted to replace it with something smaller. Continue reading “Share This (jQuery): a WordPress plugin” →

Be careful with JavaScript variable declarations

Make sure you declare all your JavaScript variables exactly once. Otherwise it’s easy to introduce bugs that are hard to diagnose, especially if you’re used to programming in a C-like language such as Java, C++ or C#. Continue reading “Be careful with JavaScript variable declarations” →

Optimised jQuery Corners plugin

I’ve created an optimised version of Dave Methvin’s excellent jQuery corner plugin. This allows jQuery users to apply all sorts of fancy effects to the corners of web page elements: the now-standard Web 2.0 rounded corners, bevels, dog-ears and many more. The plugin works by injecting extra elements into the page, and I noticed a way to achieve the same effect with fewer elements. This improves the speed and memory usage of the plugin. Continue reading “Optimised jQuery Corners plugin” →

Google Web Toolkit

Google have released the Google Web Toolkit — “Build AJAX apps in the Java language”. At first I thought this might just be their version of the Yahoo UI Library, but it turns out to be a completely different approach to the same problem. The YUI Library (and most other Ajax libraries) allow you to build a Web UI directly, using HTML and JavaScript. With GWT, you write a GUI application in Java, and GWT translates it into JavaScript and HTML for web deployment. It’s a less flexible approach, but could make it easier for Java developers to develop web applications with desktop-style GUIs — if this is what they really want. Continue reading “Google Web Toolkit” →

Ajax: How to do it

Ajax and “Web 2.0″ have been getting more and more exposure over the last year or so. It may not be quite the revolution it’s cracked up to be, but behind the hype there are useful techniques for building better applications. When people start asking you what you’re doing with Ajax/Web 2.0, you should have a good answer — so here are some thoughts on what you can do about Ajax. Continue reading “Ajax: How to do it” →

Setting the “name” attribute in Internet Explorer

I have recently needed to write code that uses JavaScript to add elements dynamically to a web page on the client. I read the relevant W3C documents and wrote the code, and it seemed to work fine. Until I tried it on Internet Explorer. After some digging, I found an explanation in the MSDN DHTML reference, on the page describing the NAME Attribute. Continue reading “Setting the “name” attribute in Internet Explorer” →