Hi,
I have a row set like this and added to the DOM
- var htmlRow = "<div id='GridRow_" + rowIndex + "' class='GridRow' data-player='" + JSON.stringify(player) + "'>\n</div>";
I get the row using JQuery 3.3.7 like this
- var row = $(this).closest('.GridRow');
var player = $(row).data('player');
This gives me the player as an object. PERFECT !
Now I take this same player modified and attach it again using JQuery this time like this :
- $(row).data('player', "'" + JSON.stringify(player) + "'");
Which looks the same way as setting it the first time but now when I ask the player again I don't get an object but this :
'{"UniqueId":"c630eb00-37be-4f30-8d35-aa9a2a1eab56","Name":"foo bar","ConfirmAnswer":0,"Email":"
foo555@bar.com","BankAmount":0,"Level":6,"Position":2,"Confirmation":false}'
Why setting the data-player using JQuery isn't the same as setting it in variable and adding it to the DOM ?
How can I set the data-player the same way as originally ? If it is possible of course !