background preloader

Javascript

Facebook Twitter

Libraries

Create a page flip effect with HTML5 canvas. Better Check Boxes with jQuery and CSS. Better Check Boxes with jQuery and CSS. Martin Angelov In this short tutorial, we will be creating a replacement for the default browser checkboxes in the form of a simple jQuery plugin.

Better Check Boxes with jQuery and CSS

It will progressively enhance your forms but at the same time fall back to the default controls if JavaScript is unavailable. The first step is to lay down the structure of the underlying HTML document. We will need a form with checkboxes which we will later be replacing with their enhanced jQuery versions. index.html <! The main container element – the #page div, holds our form.

Notice the HTML5 data attributes, specified on some of the labels. And here is the markup of our replacement checkboxes: <span class="tzCheckBox checked"><span class="tzCBContent">ON</span><span class="tzCBPart"></span></span> When our plugin is called, it will loop through the checkboxes, and insert the HTML code you can see above after each one, while at the same time hiding the original.

Checkbox Replacements Explained Now lets move on to the styling. jQuery Conclusion. "Select All" JavaScript for Forms Posting to an Array. The problem that led to this snippet of code was that when posting from a form to a PHP script, you may sometimes want to have several fields with the same name and different values.

"Select All" JavaScript for Forms Posting to an Array

For example, you might want people to be able to tick boxes to indicate which cities they have been to from a list. You would normally add "[]" to the name of the field inputs, like so: <input type="checkbox" name="cities[]" value="London"> London<input type="checkbox" name="cities[]" value="Paris"> Paris<input type="checkbox" name="cities[]" value="Berlin"> Berlin<input type="checkbox" name="cities[]" value="Madrid"> Madrid<input type="checkbox" name="cities[]" value="Rome"> Rome. 20 Things I Learned About Browsers and the Web.

IllustrationChristoph Niemann Writers/EditorsMin Li Chan, Fritz Holznagel, Michael Krantz Project CuratorMin Li Chan & The Google Chrome Team DesignFiPaul Truong DevelopmentFi Very Special Thanks To Brian Rakowski, Ian Fette, Chris DiBona, Alex Russell, Erik Kay, Jim Roskind, Mike Belshe, Dimitri Glazkov, Henry Bridge, Gregor Hochmuth, Jeffrey Chang, Mark Larson, Aaron Boodman, Wieland Holfelder, Jochen Eisinger, Bernhard Bauer, Adam Barth, Cory Ferreria, Erik Arvidsson, John Abd-Malek, Carlos Pizano, Justin Schuh, Wan-Teh Chang, Vangelis Kokkevis, Mike Jazayeri, Brad Chen, Darin Fisher, Johanna Wittig, Maxim Lobanov, Marion Fabing Nicolas, Jana Vorechovska, Daniele De Santis, Laura van Nigtevegt, Wojtek Cyprys, Dudley Carr, Richard Rabbat, Ji Lee, Glen Murphy, Valdean Klump, Aaron Koblin, Paul Irish, John Fu, Chris Wright, Sarah Nahm, Christos Apartoglou, Meredith Papp, Eric Antonow, Eitan Bencuya, Jay Nancarrow, Ben Lee, Gina Weakley, Linus Upson, Sundar Pichai & The Google Chrome Team.

20 Things I Learned About Browsers and the Web