Get Data from cell on click

Get Data from cell on click

gtsafasgtsafas Posts: 13Questions: 0Answers: 0
edited February 2010 in General
Im ultimately trying to change an image on click so as to say make a favorite star change from gray to yellow.

But first I have to know how to access the cell value. I have yet to figure this out. Could someone please help me.

[code]
var mytable;

$(document).ready(function() {

mytable = $('#ImbalanceData').dataTable( {
"bProcessing": false,
"bJQueryUI": false,
"bPaginate": false,
"sAjaxSource": 'my.json',
"iDisplayLength": -1,
"aaSorting": [[ 0, "asc" ],[ 1, "desc" ]],
"aoColumns":[
/* Star*/ { "asSorting": [ "asc" ] },
/* Symbol*/ null,
/* Buy IMB*/ null,
/*Sell IMB*/ null,
/*Paired*/ null,
/*Price */ { "bVisible": false },
/*Percentage*/ { "bVisible": false },
/*Previous*/ { "bVisible": false },
/*Status*/ { "bVisible": false }]
} );


$ ('#ImbalanceData td').live ('click', function() {
alert($(this).data);
});



} );
[/code]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    alert($(this).html()); or
    alert(this.innerHTML); ?

    Don't think you need a DataTables specific function here - although I might be missing something?

    Allan
This discussion has been closed.