Dördüncü jQuery dersimizde aşağıdakileri öğrendik;
– jQuery Live Metodu
– jQuery Append Metodu
– jQuery Index Metodu
Live Metodu Tek Olay Kullanımı
$("button").live("click", function(){
$(this).after('<button>Banada Tıkla</button>');
});
Live Metodu Birden Fazla Olay Kullanımı (jQuery 1.9 versiyonu ile bu metod kaldırılmıştır.)
$("p").live({
click: function(){
$(this).after('<p>Bunada Tıkla</p>');
},
mouseover: function(){
$(this).addClass("deneme");
},
mouseout: function(){
$(this).removeClass("deneme");
}
});
Append Metodu Kullanımı
$("a").click(function(){
$("div#Erbilen").append("<div>Bu yeni div</div>");
});
Index Metodu Kullanımı – Basit Tab Yapısı
$("div.tab:not(:first)").hide();
$("ul li").click(function(){
var index = $(this).index();
$("div.tab").hide();
$("div.tab:eq("+index+")").show();
});