Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82829

Retrieve the Text of a Cell

$
0
0

Hello,

I'm writing code that iterates through a table to update the contents of the cells. A row is set up this way:

<td id="input"><a href="http://www.somelink.com">Input Value</a></td>
<td id="output">Insert Data Here After AJAX Request</td>

My code for selecting the values looks like this:

    table.rows().every( function(rowIdx, tableLoop, rowLoop)
    {
        var in = table.row(this).cell("#input");
        var out = table.row(this).cell("#output");

        if(in[0])
        {
            $.getJSON("/API/" + in.data(), function(data){
            out.data("<a href='/lookup?search_data=" + input.data() + "'>" + data.count + "</a>");});
        }
        this.invalidate();

My issue is that "cell.data()" returns full markup and not just the text of the column.

Is there a way to retrieve just the text ("Input Value" in this example)?
Is there a better way to be doing this?


Viewing all articles
Browse latest Browse all 82829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>