如何使用JS创建并行的Bootstrap列?

问题描述 投票:0回答:3

我想使用JavaScript动态创建并行列,但是我不知道如何创建它们。这是我要使用JS创建的HTML代码。

<div class="container">
  <div class="row">
    <div class="col">
      <textarea rows="20" cols="50">At w3schools.com you will learn how to make a website. We offer free tutorials in all web development technologies.</textarea>
    </div>
    <div class="col">
      <p>Que</p>
      <div class="form-group">
        <div class="input-group">
          <input class="form-control" placeholder="test" />
        </div>
      </div>
    </div>
  </div>
</div>
javascript html
3个回答
0
投票

这将为您提供一些有关在引导网格内动态生成的想法。


0
投票

使用cloneNode,然后将appendChild用于容器。


0
投票

使用JS使其动态化并非易事,因为您不能仅将字符串(也包括模板文字)附加到节点。您必须先创建一个节点,然后添加内容,然后附加所有内容。

© www.soinside.com 2019 - 2024. All rights reserved.