Get Unique Column Values where Column contains HTML

Get Unique Column Values where Column contains HTML

pflugs30pflugs30 Posts: 1Questions: 0Answers: 0
edited February 2013 in General
I'm trying to follow the multi-filter select example (http://datatables.net/release-datatables/examples/api/multi_filter_select.html). The technique works very well for columns that contain only text. However, two of my columns contains hyperlinks; that is, HTML as in the following example: "West High School". The function fnGetColumnData doesn't recognize this as HTML, and it returns a string of the entire tag. I'd like to modify the function to return only the element's value (in this example, the text "West High School").

Can someone please provide some suggestions for making this happen? As I'm fairly new to JavaScript, I'd appreciate the point ini the right direction. Thanks in advance.

Matthew

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    A simple modification to the fnGetColumnData plugin that the example there uses is all that is needed. Just strip the HTML using a regex like this: `str.replace( /<.*?>/g, "" );` .

    Allan
This discussion has been closed.