[Local datas] How to get datas from the table to fill fields in my HTML ?
[Local datas] How to get datas from the table to fill fields in my HTML ?
Hello, dear.
Here is my issue. I'm trying to get my local datas to fill my input fields when a table's row is clicked upon.
Here is the data storage, very simple.
var data = [
[
"G800",
"Get rid of Swan",
"Pimp",
"RobCo",
"10/10/XX",
"Boston",
"22 Boston Commons",
"B door"
]
];
Here is my function.
$('#Main_table tbody').on('click', 'tr', function () {
var rowIndex = myTable.row(this).index();
alert(data[rowIndex][0]);
$('#action_t_filenumber').html() = data[rowIndex][0];
});
As it is, it kind of works. My alert is providing the data i'm looking for.
But when I try to put in into my input field ( ('#action_t_filenumber').html() = data[rowIndex][0]; ) I end up with some error.
Uncaught ReferenceError: Invalid left-hand side in assignment.
For now on, I'm trying to transform my data to string, but if some of you have any clue on what's going wrong, I'm all ears.
Have a nice day.
Answers
Okay, a friend of mine just got me a tiny hint and here we go.
$('#action_t_filenumber').val( data[rowIndex][0] );
Working fine, now.