HTML5 tricks

Facebook Twitter

HTML5 Placeholder Input Fields Fixed with jQuery. HTML5 added some new features for input and textarea fields.

HTML5 Placeholder Input Fields Fixed with jQuery

One is inspired by Safari’s search box: placeholder This adds an default text if the textfield is empty: jQuery Fix for All Browsers Currently the placeholder works with the latest Webkit (Safari nightly build) and Chrome only. In Safari 4.0 placeholders won’t appear in textareas. For all other browsers, the following short jQuery fix will help you. $('[placeholder]').focus(function() { var input = $(this); if (input.val() == input.attr('placeholder')) { input.val(''); input.removeClass('placeholder'); } }).blur(function() { var input = $(this); if (input.val() == '' || input.val() == input.attr('placeholder')) { input.addClass('placeholder'); input.val(input.attr('placeholder')); } }).blur(); Don’t forget the last blur() call.

Update: Robin mentioned in the comments, that this would post the placeholder values to the form action script. HTML5 Snippets. The html5 switch. Depending on who you talk to, you should have been using HTML5 months, nay years ago; or it's something you might be using in 2022.

the html5 switch

As usual the truth is somewhere between the glib extremes. There's no one-size-fits-all answer to questions of platform choice: you have to consider the benefits for your own scenario. But with HTML5 I'd say if you haven't switched yet, for most people it's probably time - there's a form of "switching" that will work for you. Some people seem caught up on the problem that many features have very poor support across browsers; or are simply put off by the thought of redoing their entire code base.

HTML5 Boilerplate - A rock-solid default template for HTML5 awesome. HTML5 Starter Pack by Radu Chelariu. Download the pack Latest version: 3.1 (July, 2013) Whenever I start a new project, I really hate doing all those repetitive bits over & over again.

HTML5 Starter Pack by Radu Chelariu

And I'm betting that, since you're here, you do too. This starter pack addresses this very issue in the cleanest, most honest and real way I can. Why a starter pack? This pack is born out of consideration for fellow designers and developers. To me, any kind of starter pack or boilerplate, as some call these things, are utterly useless when the stuff they drag in with them only causes bloat and confusion. Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Certainly, Antoine de Saint-Exupéry's famous saying doesn't apply quite to everything, but in the case of a starter pack, it absolutely does. And in keeping with the above quote, this pack features the bare essentials and no more. The Ultimate HTML 5 Cheat Sheet. Designing websites can be quite a jungle sometimes since, with time, the number of languages at our disposal has gotten so much greater.

The Ultimate HTML 5 Cheat Sheet

Way back when things were new and the Internet only had a couple of million websites (if you could even call them that comparing them to today’s media experiences), HTML was the only language that you needed to master in order to put up a text site to showcase yourself. Well, it was a heck of a lot simpler back then, but since then, the flora of languages to use has grown to what would take you about a library to learn. So which one should you choose if you want to be sure to grab the most inner core functions of the Internet?

That’s of course a matter of opinion and taste, but HTML is always a must when putting something online. With the release of HTML 5, things started getting even more complicated. Dive Into HTML5. Dive Into HTML5. HTML5 Reset. Easy HTML5 Template. I’ll be the first to admit that when I see a default template like HTML5 Boilerplate, it brings about a swirl of emotions.

Easy HTML5 Template

On the one hand, I’m ridiculously intimidated by the incredible amount of knowledge and experience that’s been collected into one place for the benefit of front-end developers. So much so, that I wonder what I’m even doing in this industry, because it reminds me of how far behind I am. On the other hand, I’m inspired, because there’s so much more to learn, and it’s exciting to add new nuggets of knowledge to my toolkit, and I can’t wait to hit the books and grow my knowledge base. Periodic Table of the Elements - Josh Duck. HTML 5 Templates, HTML 5 canvas, HTML5 video, HTML 5 XHTML, HTML.  A showcase of sites using HTML5 markup.

Html5 Canvas

HTML5 elements in Internet Explorer without Javascript. Huh?

HTML5 elements in Internet Explorer without Javascript

Section element? I don't see no stinkin' section element. You must be mistaken, pal. What? No, I don't believe in them. John Resig drummed up a clever little solution that uses a tiny piece of Javascript to force Internet Explorer to accept those new elements: javascript: var a = ['section', 'article', 'nav', 'header', 'footer', for (var i = 0, j = a.length; i < j; i++) { document.createElement(a[i]);} Unfortunately, it doesn't work when Javascript is turned off. And of course, after putting a new website live, the client calls up and tells you one of their "clever" system administrators has just turned off Javascript on every single workstation due to "safety concerns" and refuses to turn it back on.