In my JS code, I change part of a "stock" datastructure (playing cards face up on a table) and then want to have the browser redraw it. I do the update to the stock data element, but the screen won't redraw until I resize the window (or reload the whole page, which is too slow).
So, from JS, how can I get the browser to reanalyze this stock element?
For example, I use this STOCK element (pseudo-code):
Next, I have a function which manipulates the .items portion of it. So this:
becomes this (two items have swapped indices):
But: The display won't update automatically when the stock item is changed. However, if I resize the browser window, even just a few pixels, then all the cards jump to their proper places (great!). But then if a player adds stock items to ones on the board, they jump around how I don't want them to be (bad!).
I tried things like this (and several similar which I found online) but it errors "Cannot read property 'load' of null"
Any ideas?
So, from JS, how can I get the browser to reanalyze this stock element?
For example, I use this STOCK element (pseudo-code):
Code: Select all
this.downArea[player_id].addToStockWithId(...yadadaya... proper stuff...) // This is set up properlyCode: Select all
items: Array(4)
0: {id: "30", type: 13}
1: {id: "29", type: 15}
2: {id: "69", type: 16}
3: {id: "161", type: 52}
length: 4
__proto__: Array(0)Code: Select all
items: Array(4)
0: {id: "30", type: 13}
1: {id: "161", type: 52}
2: {id: "29", type: 15}
3: {id: "69", type: 16}
length: 4
__proto__: Array(0)I tried things like this (and several similar which I found online) but it errors "Cannot read property 'load' of null"
Code: Select all
$("#downArea").load(" #downArea > *");