Can class in html be assigned dynamically?

<body class="row">
    <div class="container body">
    </div>
</body>    

for example, I have a requirement that I want to dynamically set the class style of body based on the result of a js method, and
switch between row and col.

the addClass, effect of trying to use jquery is not good.

is there any other way? does class support splicing? < body class= "+ Result () +" > something like this?

I finally implemented it with a variable set in the background of. I think there should be another way at the front end, right?

Mar.25,2021

document.body.className = result ()? 'row':' col'


it is not clear what the specific effect of your row and col is and what effect you want to achieve

document.body.className = 'col'

vue supports setting dynamic class names


it can be done with a classList. Is it mentally retarded to recommend Vue? Don't fucking fool people

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf4862-54b62.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf4862-54b62.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?