What I want to do is that when the width
of the page is less than the value shown below it will enter data-tablesaw-mode="stack
in the site shown below! I'm new to JavaScript
but I need this for a project! Thanks to anyone who helps I am available to provide any information that is important.
What I want to insert
data-tablesaw-mode="stack"
How I'm trying to do
<script>
var width = (window.innerWidth > 0) ? window.innerWidth : screen.width;
var table = document.getElementsById('table-hide');
if width<39.9375em {
table. += "data-tablesaw-mode="stack";
}
</script>
HTML where I want to insert
<table id="table-hide" class="tablesaw tablesaw-stack">