First, you’ll need the table to be in HTML
format. Do that first. In the table
html properties, make sure it has a unique id
.
If the table has different weights for the roll, set those up:
Add data-weight
attributes to all of the tr
’s that need it. You can do it as a percentage or just the amount of sides the “dice” would have for that result.
Under the table you need a button. Add this:
<button class="roller" data-target-table="placeholder" id="rollButton">Roll</button>
Replace the placeholder in data-target-table
with the id
of the table.
Did you enjoy this post? Consider signing up to the mindstorm, my semi-regular newsletter!