JavaScript
JavaScript is the behaviour layer of the Web. The articles found here generally focus on unobtrusive, accessible use of JavaScript rather than fancy effects for the sake of fancy effects.
Making elements keyboard focusable and clickable
Either use natively keyboard accessible elements to trigger JavaScript interactions or make what you use instead mimic the appropriate native element as closely as possible.
Using JavaScript to check if images are enabled
It can be useful to know if images are enabled in the browser, so that you can adjust your CSS and JS to make sure that the page is still usable even if images aren’t loaded.
Tell CSS that JavaScript is available ASAP
When you need to apply different styling depending on the availability of JavaScript, you want to let CSS know whether JS is on or not as soon as possible during page load.
An alternative to select elements as navigation in narrow viewports
Using a select element for navigation in narrow viewports is not an ideal solution. Here is an alternative technique that uses real links and is fully stylable.
Safer event handling with jQuery namespaced events
By namespacing events in your jQuery functions, you reduce the risk of interfering with other scripts when adding or removing handlers.
iOS orientation change and automatic text resizing
There is a clever script that fixes the iOS orientation change zoom bug. Here is a reminder about a couple of issues you may run into when using it.
End tags, semi-colons and maintainable code
Relying on browsers to magically insert missing code, like optional HTML tags or semi-colons and curly braces in JavaScript, is not developer-friendly.
Use only what you need
Don’t add boilerplate code, polyfills, shivs, frameworks and other things that increase the weight of your site unless you actually need it.
How to adjust an iframe element’s height to fit its content
In some cases JavaScript can be used to resize an iframe element to make it as tall as its content, making it look like the content is part of the parent page.
JavaScript-created markup also needs to be semantic and accessible
Browsers, assistive technology and end users have to deal with non-semantic markup even if it is inserted by JavaScript functions.
An accessible, keyboard friendly custom select menu
A way of styling the closed state of select elements without sacrificing accessibility.
Adaptive Web Design (Book review)
In this brief and easy-to-read book, Aaron Gustafson does an excellent job of explaining what progressive enhancement is and how to apply it in your daily work.
Get element text, including alt text for images, with JavaScript
A JavaScript function that returns the text content of an element and its descendants, including alternative text for images and image map areas.
Validate URL syntax with JavaScript
How to use JavaScript to verify that the path, query and fragment parts of a URL use valid syntax according to RFC 3986.
Make links focusable (or use real buttons)
When using a link to trigger JavaScript functionality, make it keyboard focusable by giving it a non-empty href attribute. Or use a real button instead.
How to find the center of an area element with JavaScript
A simple JavaScript function that takes an area element’s shape and coords attributes and returns an array holding the horizontal and vertical center coordinates.
Enterprise HTML, CSS and JavaScript explained
Explanations of why some of the bad practices that are made fun of at the Enterprise CSS/HTML/JS sites are bad practices.
Tips for creating enterprise-level HTML, CSS and JavaScript
A set of sites making fun of worst practice front-end code commonly found on enterprise type sites and in large content management systems.
Minimise file size with the YUI Compressor TextMate Bundle
You can use the YUI Compressor TextMate bundle to make minifying your CSS and JavaScript files from within TextMate as easy as hitting a keystroke.
New windows with JavaScript and the target attribute
A better, less obtrusive way of using JavaScript to open new windows than using window.open() is to programmatically set the target attribute.
Page navigation
Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Page 7Subscribe / follow
Sponsors
Authentic Jobs
- Design Director at Happy Cog (Austin, Texas, Te, US)
- Web Developer at Forepoint Ltd (Preston, GB)
- UI/UX Engineer at Skyscraper (San Francisco, CA, Ca, US)
- Communications Designer at Causes.com (San Francisco, Ca, US)
DreamHost web hosting
Use the promo code 456BEREASTREET3 to save USD 20 when you sign up for DreamHost

