Skip to content

Instantly share code, notes, and snippets.

@remino
Created April 10, 2012 02:35
Show Gist options
  • Save remino/2347999 to your computer and use it in GitHub Desktop.
Save remino/2347999 to your computer and use it in GitHub Desktop.
jQuery plugin: get column count in table
$.fn.getColumnCountInTable = ->
return unless @is 'table'
count = 0
@find('tr:first').find('th, td').each ->
count += $(@).attr 'colspan' or 1
count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment