EACH() METODU
For döngüsü olarak düşünün , tek farkı ise each elementlerin toplamını kendi alıyor ve hepsini tek tek işliyor.
örnek:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("li").each(function(){
alert($(this).text())
});
});
});
</script>
<title>each ödev</title>
</head>
<body>
<button>göster</button>
<ul>
<li>Coffee</li>
<li>Milk</li>
<li>Soda</li>
</ul>
</body>
</html>
Hiç yorum yok:
Yorum Gönder