<table class="form-table">
    <tbody>
    <tr>
        <th><label for="feature">房源特色</label></th>
        <td>
            <div id="feature" class="row">
            </div><br/>
            <button type="button" class="button action" data-toggle="modal" data-target="#houseFeature" id="featureBt">
                添加特色
            </button>
        </td>
    </tr>
    </tbody>
</table>

<script>
    $(document).ready(function () {
        {% if featureOld %}
        var data = {{ featureOld }};
        $.each(data, function (i, item) {
            addFeature(item.tag_id, item.name);
        });
        {% endif %}
        //显示选中的特色
        init_modal_addTag(1, function (id, value) {
            addFeature(id, value);
        });
        existsCancel();
    });
    function addFeature(id, value) {
        var houseFeature = $("<input>").attr({"type": "hidden", "name": "data[houseFeature][]", "value": id});
        var cancel = $("<span>").attr("aria-hidden", "true").addClass("glyphicon glyphicon-remove featureCancel ");
        var span = $("<span>").attr("style", "margin-right:5px").append(value);
        var divCol = $("<div>").append(houseFeature).append(span).append(cancel).addClass("col-md-3").attr("style", "margin-bottom:10px");
        $("#feature").append(divCol);
    }

</script>