JQuery object object output

this is my table button with value

   <td>' + valueAusData.Spieler_Name + '</td>
   <td>' +  valueAusData.Note + '</td>
   <td>' + valueAusData.Tore +'</td>
   <td> <button class="edit-modal btn btn-info" id="inputSpieler" value="valueAusData.Tore">' + "Edit" + '</button>

and here is my java script function

 $( '#myTable' ).on( 'click', 'button', function(g) {

But I get back object object and not the value of valueAusData?

Okay I have the solution


But how can I store more the 1 field in the button value part? I need value="valueAusData.Tore" and value="valueAusData.Note" and then I want to alert them.

2 answers

  • answered 2017-08-12 09:53 Hamza Abdaoui

    From the documentation, function(g) is :

    handler Type: Function( Event eventObject [, Anything extraParameter ] [, ... ] )

    So g is an Event which is an Object.

    I think that you are trying to display a modal, so add this line instead of alert(g); :


  • answered 2017-08-12 10:27 MrViK

    If ausData is type object, when you try to convert it to a string, result will be Object object. If you expect to get the entire object as a string use JSON.stringify(data)