Skip to content

Instantly share code, notes, and snippets.

@rutger1140
Created February 15, 2012 08:03
Show Gist options
  • Save rutger1140/1834308 to your computer and use it in GitHub Desktop.
Save rutger1140/1834308 to your computer and use it in GitHub Desktop.
Add CSS helper classes in jQuery
/**
* CSS Helpers
* @description: Used for decorating input types, first and last childs
*/
$('input[type=checkbox]').addClass('checkbox');
$('input[type=radio]').addClass('radio');
$('input[type=file]').addClass('file');
$('[disabled=disabled]').addClass('disabled');
$('table').find('tr:even').addClass('even');
$('table').find('tr:first-child').addClass('first');
$('table').find('tr:last-child').addClass('last');
$('ul').find('li:first-child').addClass('first');
$('ul').find('li:last-child').addClass('last');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment