الفرق بين المراجعتين ل"jQuery/last of type selector"
< jQuery
اذهب إلى التنقل
اذهب إلى البحث
جميل-بيلوني (نقاش | مساهمات) (إضافة محتويات الصفحة.) |
|||
سطر 1: | سطر 1: | ||
<noinclude>{{DISPLAYTITLE:المحدد <code>:last-of-type</code> في jQuery}}</noinclude> | <noinclude>{{DISPLAYTITLE:المحدد <code>:last-of-type</code> في jQuery}}</noinclude> | ||
− | == | + | == المحدد <code>:last-of-type</code> == |
=== الوصف === | === الوصف === | ||
سطر 54: | سطر 54: | ||
== مصادر == | == مصادر == | ||
− | * [http://api.jquery.com/last-of-type-selector/ صفحة المحدِّد :last-of-type في توثيق jQuery الرسمي.] | + | * [http://api.jquery.com/last-of-type-selector/ صفحة المحدِّد :last-of-type في توثيق jQuery الرسمي.] |
[[تصنيف:jQuery]] | [[تصنيف:jQuery]] | ||
[[تصنيف:jQuery Selectors]] | [[تصنيف:jQuery Selectors]] |
مراجعة 07:56، 30 مايو 2018
المحدد :last-of-type
الوصف
يختار هذا المحدِّد جميع العناصر التي يُعدُّ كل واحد منها العنصر الأخير بين أخوته التي لها الاسم ذاته.
jQuery( ":last-of-type" )
أُضيف مع الإصدار: 1.9.
يطابق المحدِّد :last-of-type
العناصر التي لا تملك عناصر أخرى ولها الأب نفسه واسم العنصر نفسه أيضًا في الصفحة.
أمثلة
إيجاد العنصر <span>
الأخير في كل عناصر <div>
المتطابقة وتغيير تنسيقها وإضافة بعض التأثيرات التفاعلية إليها (عند مرور مؤشر الفأرة عليها):
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>last-of-type demo</title>
<style>
span.solast {
text-decoration: line-through;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<div>
<span>Corey,</span>
<span>Yehuda,</span>
<span>Adam,</span>
<span>Todd</span>
</div>
<div>
<span>Jörn,</span>
<span>Scott,</span>
<span>Timo,</span>
<b>Nobody</b>
</div>
<script>
$( "span:last-of-type" )
.css({ color:"red", fontSize:"80%" })
.hover(function() {
$( this ).addClass( "solast" );
}, function() {
$( this ).removeClass( "solast" );
});
</script>
</body>
</html>