المحدد :root
في jQuery
< jQuery
اذهب إلى التنقل
اذهب إلى البحث
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
المحدد :root
الوصف
يحدِّد العنصر الجذر في شجرة المستند.
jQuery( ":root" )
أُضيف مع الإصدار: 1.9.
العنصر الجذر في مستندات HTML هو دومًا العنصر <html>
، وهو العنصر الذي يحدده $(":root")
.
أمثلة
إظهار اسم عقدة العنصر الجذر:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>root مثالٌ عن استعمال المحدد</title>
<style>
span.fot {
color: red;
font-size: 120%;
font-style: italic;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<div id="log">العنصر الجذر في هذا المستند هو: </div>
<script>
$( "<b></b>" ).html( $( ":root" )[ 0 ].nodeName ).appendTo( "#log" );
</script>
</body>
</html>