Skip to content
Advertisement

how can you make html coming from .after() come out as inline elements

how is it possible to make html divs inline each time a new element is created using the .after() function in js , I current have a button that creates a new div, only problem is it creates it under the first div in my container and continues like this in a block layout rather than inline

js

JavaScript

html

JavaScript

looks like this you can see the bottom 2 divs are the newly created elements using .after() in js:

enter image description here

Advertisement

Answer

You are adding a new row on each click. If you want a new column, you’ll need to check if you should be appending a column to an existing row or creating a new row and adding to that.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement