在bootstrap-tagsinput中的标签之前移动文本输入

时间:2018-03-01 17:16:29

标签: jquery html twitter-bootstrap bootstrap-tags-input

是否有一种简单的方法可以将文本输入移动到bootstrap-tagsinput中的标记上方?

这是一个可能说明我的意思的代码:https://codepen.io/uebes/pen/KQEdeP

换句话说,我希望标签在输入文本框之后添加如下:

    <div class="bootstrap-tagsinput">
        <input type="text" placeholder="">
        <span class="tag label label-info"> Test 1<span data-role="remove"></span></span>
        <span class="tag label label-info"> Test 2<span data-role="remove"></span></span>
        <span class="tag label label-info"> Test 3<span data-role="remove"></span></span>
        <span class="tag label label-info"> Test 4<span data-role="remove"></span></span>
        <span class="tag label label-info"> Test 5<span data-role="remove"></span></span>
    </div>

而不是在文本框之前添加新标记的默认值:

    <div class="bootstrap-tagsinput">
        <span class="tag label label-info"> Test 1<span data-role="remove"></span></span>
        <span class="tag label label-info"> Test 2<span data-role="remove"></span></span>
        <span class="tag label label-info"> Test 3<span data-role="remove"></span></span>
        <span class="tag label label-info"> Test 4<span data-role="remove"></span></span>
        <span class="tag label label-info"> Test 5<span data-role="remove"></span></span>
        <input type="text" placeholder="">
    </div>

1 个答案:

答案 0 :(得分:0)

你的意思是......?

&#13;
&#13;
<div class="bootstrap-tagsinput">
        <input type="text" placeholder=""><br>
        <span class="tag label label-info"> Test 1<span data-role="remove"></span></span>
        <span class="tag label label-info"> Test 2<span data-role="remove"></span></span>
        <span class="tag label label-info"> Test 3<span data-role="remove"></span></span>
        <span class="tag label label-info"> Test 4<span data-role="remove"></span></span>
        <span class="tag label label-info"> Test 5<span data-role="remove"></span></span>
    </div>
&#13;
&#13;
&#13;