<link href="plugins/bootstrap/bootstrap.css" rel="stylesheet">
<style type="text/css">
.Draggable {
width: 120px;
height: 120px;
background: red;
-moz-border-radius: 70px;
-webkit-border-radius: 70px;
border-radius: 70px;
}
</style>
<form>
<div class="Draggable"></div>
</form><br><br><br>
<button id="btn1">เพิ่มบอล</button>
<button id="btn2">ลบบอล</button>
<script src="plugins/jquery/jquery.min.js"></script>
<script type="text/javascript">
$("#btn1").click(function(){
var teme = $("<div class='Draggable'> </div>")
$("body").append(teme)
});
$("#btn2").click(function(){
var teme = $("<div class='Draggable'> </div>")
for ( i = teme.length - 1; 0 <= i; i--) {
(teme
).remove();
}
});
</script>
ผมติดปัญหาตรงลบข้อมูลเมื่อกด btn1 แล้วลูกบอลเพิ่ม แล้วเมื่อกด btn2 แล้วมันไม่ลบให้
ลบกวนแนะนำรายละเอียดด้วยครับ ขอบคุณครับ
ช่วยแนะนำการเพิ่มลูกบอล / ลบลูกบอล ด้วย Button หน่อยครับ!
<style type="text/css">
.Draggable {
width: 120px;
height: 120px;
background: red;
-moz-border-radius: 70px;
-webkit-border-radius: 70px;
border-radius: 70px;
}
</style>
<form>
<div class="Draggable"></div>
</form><br><br><br>
<button id="btn1">เพิ่มบอล</button>
<button id="btn2">ลบบอล</button>
<script src="plugins/jquery/jquery.min.js"></script>
<script type="text/javascript">
$("#btn1").click(function(){
var teme = $("<div class='Draggable'> </div>")
$("body").append(teme)
});
$("#btn2").click(function(){
var teme = $("<div class='Draggable'> </div>")
for ( i = teme.length - 1; 0 <= i; i--) {
(teme ).remove();
}
});
</script>
ผมติดปัญหาตรงลบข้อมูลเมื่อกด btn1 แล้วลูกบอลเพิ่ม แล้วเมื่อกด btn2 แล้วมันไม่ลบให้
ลบกวนแนะนำรายละเอียดด้วยครับ ขอบคุณครับ