I am struggling with centering a button on my webpage. Currently, I have the following code for creating the button:
var button = ($('<button>', {
"id": "jspsych-free-sort-done-btn",
"class": "jspsych-free-sort",
"html": "Done",
...
}));
After some research, I found a solution on stackoverflow that suggested using .wrap() to add a wrapper div in order to center the button:
button.wrap("<div style='text-align:center'> </div>");
However, it seems like the button is not getting centered with this approach. Does .wrap() cancel the wrapper's style properties? If so, can someone please guide me on how to properly center my button? Your help would be greatly appreciated. Thank you!