A created a function that renders buttons depending on how many data gotten from database.
I want to use js to set the style the button container differently,
especially setting property of of the button container to flex direction to column when it starts wrapping,
Since the website can have many buttons.
Is there a way to use javascript to check for the flexwrap property of the button container.
I tried this code but it is returning an empty string Console.log (btnContainer.style.flexWrap)
CodePudding user response:
try running btnContainer.style in the console directly, rather than console.log(). hope it will help you find a solution
CodePudding user response:
This commend check only inline style like <div style="flex-wrap:wrap;"></div>
. Now if you console.log(document.querySelector('div').style.flexWrap)
you will get string with value "wrap".
The solution your problem is add style this element in html inline as I wrote above or in js like document.querySelector('div').style.flexWrap = wrap