0

running simple export javscript function for this stackoverflow - Export to CSV using jQuery and html

example here: http://jsfiddle.net/terryyounghk/KPEGU/

however I want to change it up so it only gets rows that have a certain class, this is what i've tried so far.

original

var $rows = $table.find('tr:has(td)'),

mine

var $rows = $table.find('tr.hasClass('show'):has(td)'),

I know nothing about JS, apparently, so help is much appreciated.

Community
  • 1
  • 1

1 Answers1

2

You don't need to use hasClass in selector. Your code should be:

var $rows = $table.find('tr.show:has(td)'),

where your class name is show. Dot (.) in jQuery and CSS means class selector already.

antyrat
  • 26,266
  • 9
  • 69
  • 74