تطبيقات ويب Development Tutorials, Guides & Insights
Unlock 1+ expert-curated تطبيقات ويب tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your تطبيقات ويب skills on DeveloperBreeze.
Adblocker Detected
It looks like you're using an adblocker. Our website relies on ads to keep running. Please consider disabling your adblocker to support us and access the content.
Tutorial
javascript
كيفية بناء تطبيقات تفاعلية باستخدام JavaScript و HTML و CSS
الآن، حان وقت إضافة التفاعلية باستخدام JavaScript. سنقوم بكتابة كود يجعل التطبيق يتفاعل مع المستخدم عند الضغط على الزر.
// الحصول على العناصر من DOM
const usernameInput = document.getElementById('username');
const submitBtn = document.getElementById('submitBtn');
const greetingParagraph = document.getElementById('greeting');
// إضافة حدث "click" للزر
submitBtn.addEventListener('click', function() {
const username = usernameInput.value;
// التحقق من أن المستخدم أدخل اسمه
if (username.trim() !== "") {
greetingParagraph.textContent = `مرحبًا، ${username}! شكرًا لاستخدام تطبيقي.`;
} else {
greetingParagraph.textContent = "يرجى إدخال اسمك.";
}
});Sep 26, 2024
Read More