<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
</head>
<body>
<button type="button" onclick="submit();">launch</button>
<button type="button" onclick="clear();">clear</button>
<div>
Result:<br>
<div id="result">
</div>
</div>
<script>
function clear() {
$('#result').empty()
}
function submit() {
$('#result').append('<div>xxxxx</div>')
}
</script>
</body>
</html>
Launch
button works well but clear
doesn't. I run $('#result').empty()
in console, it clear the div as expected.
You may debug my code in jsfiddle.