The button generated dynamically by JQuery refreshes the whole page at one point.

the button dynamically generated by JQuery disappears a little bit. Does any boss know why?

 <div class="col-sm-4">
      <button type="button" class="btn btn-md btn-link" id="data_con_Add"></button>
</div>

 $(document).on("click", "-sharpdata_con_Add", function () {
        $("-sharpdata_con_Add").addClass("disabled");
        var helpDiv = $("<div></div>").addClass("input-group");
        var helpinput = $("<input type="text" id="searchInfo">").addClass("form-control1 input-search");
        var helpspan = $("<span></span>").addClass("input-group-btn")
            .append($("<button></button>").addClass("btn btn-success search_btn").append($("<i></i>").addClass("fa fa-search")));
        helpDiv.append(helpinput).append(helpspan).appendTo("-sharpnew-problem");

        var helpDiv2 = $("<div></div>").addClass("col-md-6 form-group filled");
        var helpLabel = $("<label></label>").addClass("control-label").append("Select");
        var helpSelect = $("<select name="cont"></select>").addClass("form-control1 ng-invalid ng-invalid-required");
        helpDiv2.append(helpLabel).append(helpSelect).appendTo("-sharpnew-problem");
    });
    

then the interface goes like this

:

then click the red button and the whole page will refresh. Why? Change it to a tag and click on it. I didn"t bind the event for this button. Do any bosses know why? For advice, thank you.


. No type attribute is added, is it? No, the default is submit.

< hr >

besides, your append is a bit suffocating. Can't you push it to an array and write only one?

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-1b31518-2aacb.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-1b31518-2aacb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?