Corat-coret 06 – jquery.live()

Dengan menggunakan jquery.live():

$(".tombol_dgn").live("click", function(){
$('#dgn_live').after("<button class='tombol_dgn'>Tombol dengan live</button>");
});

Dengan menggunakan jquery.click():

$(".tombol_bkn").click(function(){
$('#bkn_live').after("<button class='tombol_bkn'>Tombol tanpa live</button>");
});

Skrip lengkap untuk demo:

<html>
<head>
<title>Live Jquery</title>
<script src='jquery.js' type='text/javascript'></script>
<script type='text/javascript'>
$(document).ready(function(){
$(".tombol_dgn").live("click", function(){
$('#dgn_live').after("<button class='tombol_dgn'>Tombol dengan live</button>");
});

$(".tombol_bkn").click(function(){
$('#bkn_live').after("<button class='tombol_bkn'>Tombol tanpa live</button>");
});
});
</script>
</head>
<body>
<div id='dgn_live'>
<button class='tombol_dgn'>Tombol dengan live</button>
</div>
<div id='bkn_live'>
<button class='tombol_bkn'>Tombol tanpa live</button>
</div>
</body>
</html>

Lihat Demo

Silahkan Komentar ... !

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s