DeveloperBreeze

Javascript Programming Tutorials, Guides & Best Practices

Explore 93+ expertly crafted javascript tutorials, components, and code examples. Stay productive and build faster with proven implementation strategies and design patterns from DeveloperBreeze.

مكتبة jQuery: استخدام JavaScript بسهولة وفعالية

Tutorial September 26, 2024
javascript

  • عند النقر على الزر، سيتم تغيير نص العنصر h1 إلى "تم تغيير العنوان!" باستخدام .text().
<!DOCTYPE html>
<html lang="ar">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>إضافة CSS باستخدام jQuery</title>
    <style>
        .highlight {
            background-color: yellow;
        }
    </style>
</head>
<body>

    <p id="paragraph">هذا نص بسيط.</p>
    <button id="toggleHighlight">تبديل اللون</button>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script>
        $('#toggleHighlight').click(function() {
            $('#paragraph').toggleClass('highlight');
        });
    </script>
</body>
</html>