Js html () coverage ask for a hierarchical relationship

html Code
<div class="row">
        <div class="col-sm-6">
            <select class="form-control m-b" name="server_lists" id="server_lists">
            <option></option>
                {% for server_i in server_lists %}
                <option value="{{ server_i.id }}">{{ server_i.public_ip }}</option>
                {% endfor %}
            </select>
        </div>
    <div class="col-sm-6 pull-right">
        <select class="form-control m-b" name="server_lists" id="server_lists">
        <option></option>
            {% for server_i in server_lists %}
            <option value="{{ server_i.id }}">{{ server_i.public_ip }}</option>
            {% endfor %}
        </select>
    </div>
    </div>

<div class="row">
    <div class="col-sm-6">

    <button type="button" class="btn btn-default" id="select-all"></button>
    <button type="button" class="btn btn-default" id="deselect-all"></button>

        <select id="pre-selected-options" multiple="multiple" name="game_id">

        </select>
    </div>
</div>

<br>

<div class="row">
    <div class="col-sm-4">
        <button class="btn btn-primary"   type="button" onclick="mtSelect(this)">
            
        </button>

    </div>
js Code
<script type="text/javascript">
$(document).ready(function () {
    $("-sharppre-selected-options").multiSelect();
        $("-sharpselect-all").click(function(){
            $("-sharppre-selected-options").multiSelect("select_all");
                return false;
        });
        $("-sharpdeselect-all").click(function(){
          $("-sharppre-selected-options").multiSelect("deselect_all");
          return false;
        });

    $("-sharpserver_lists").change(function () {
        var server_i = $("-sharpserver_lists").val();
        $.ajax({
            data: {"obj_id": server_i, csrfmiddlewaretoken: "{{ csrf_token }}"},
            type: "POST",
            url: "/pro1/gamemigratedata/" + server_i + "/",
            success: function (data) {
                var content = "";
                $.each(data, function (i, item) {
                    content += "<option value="+"""+item.gameid+"""+">"+item.gameid+"</option>"

                });
                alert(content);
                $("-sharppre-selected-options").html(content)
            }
            
        })
    });

});

</script>

questions are as follows:

clipboard.png

js
alert(content);
$("-sharppre-selected-options").html(content)


clipboard.png

so how do you change the situation now?

Jun.05,2021

I don't know what this multiSelect is, jqueryui? No, but many components are self-built with div and span, not necessarily with native tags. Even if it is used, the basic information needs to be written in before initialization, and the later dynamic modification depends on whether the component is given to the interface. This should not be a question of the scope of html, but the timing of initialization.
take a look at whether this component provides the corresponding method to modify dynamically, or destroy the previous component before using html (), and reinitialize one after adding option.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37b52-2c09d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37b52-2c09d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?