Skip to content

Commit 94cfb76

Browse files
align on single apostrophe in code samples
1 parent a560585 commit 94cfb76

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ h1 {
455455
6. **Include a JavaScript File**: in `script.js`, write a simple script:
456456

457457
```javascript
458-
document.addEventListener('DOMContentLoaded', function() {
458+
document.addEventListener("DOMContentLoaded", function() {
459459
alert("Welcome to My First Website!");
460460
});
461461
```
@@ -492,8 +492,8 @@ Here's a simple exercise to manipulate the DOM using JavaScript:
492492
2. **JavaScript to Change Text Color**: in `script.js`, add a script to change the color of the paragraph when the button is clicked:
493493

494494
```javascript
495-
document.getElementById('changeColorButton').addEventListener('click', function() {
496-
document.querySelector('p').style.color = 'red';
495+
document.getElementById("changeColorButton").addEventListener("click", function() {
496+
document.querySelector("p").style.color = "red";
497497
});
498498
```
499499

@@ -1155,10 +1155,10 @@ Add inline JavaScript to enhance validation.
11551155

11561156
```html
11571157
<script>
1158-
document.getElementById('registrationForm').addEventListener('submit', function(event) {
1158+
document.getElementById("registrationForm").addEventListener("submit", function(event) {
11591159
if (!this.checkValidity()) {
11601160
event.preventDefault(); // Prevent form submission if validation fails
1161-
alert('Please fill out the form correctly.');
1161+
alert("Please fill out the form correctly.");
11621162
}
11631163
});
11641164
</script>
@@ -1225,16 +1225,16 @@ Using JavaScript, we'll add event listeners to dynamically update the form.
12251225

12261226
```html
12271227
<script>
1228-
document.getElementById('choice').addEventListener('change', function() {
1228+
document.getElementById("choice").addEventListener("change", function() {
12291229
const value = this.value;
1230-
const additionalFields = document.getElementById('additionalFields');
1230+
const additionalFields = document.getElementById("additionalFields");
12311231
1232-
additionalFields.innerHTML = ''; // Clear existing fields
1232+
additionalFields.innerHTML = ""; // Clear existing fields
12331233
1234-
if (value === 'books') {
1235-
additionalFields.innerHTML = '<label for="author">Author:</label><input type="text" id="author" name="author">';
1236-
} else if (value === 'movies') {
1237-
additionalFields.innerHTML = '<label for="director">Director:</label><input type="text" id="director" name="director">';
1234+
if (value === "books") {
1235+
additionalFields.innerHTML = "<label for="author">Author:</label><input type="text" id="author" name="author">";
1236+
} else if (value === "movies") {
1237+
additionalFields.innerHTML = "<label for="director">Director:</label><input type="text" id="director" name="director">";
12381238
}
12391239
});
12401240
</script>
@@ -1479,17 +1479,17 @@ In `app.js`, you might have functions that dynamically load content into the `<m
14791479

14801480
```javascript
14811481
function loadHome() {
1482-
document.getElementById('mainContent').innerHTML = '<h1>Welcome to Our SPA</h1><p>This is the home page content.</p>';
1482+
document.getElementById("mainContent").innerHTML = "<h1>Welcome to Our SPA</h1><p>This is the home page content.</p>";
14831483
// Additional scripting to enhance accessibility and SEO
14841484
}
14851485

14861486
function loadAbout() {
1487-
document.getElementById('mainContent').innerHTML = '<h1>About Us</h1><p>Learn more about our mission and values.</p>';
1487+
document.getElementById("mainContent").innerHTML = "<h1>About Us</h1><p>Learn more about our mission and values.</p>";
14881488
// Additional scripting to enhance accessibility and SEO
14891489
}
14901490

14911491
function loadContact() {
1492-
document.getElementById('mainContent').innerHTML = '<h1>Contact Us</h1><p>Contact details and form.</p>';
1492+
document.getElementById("mainContent").innerHTML = "<h1>Contact Us</h1><p>Contact details and form.</p>";
14931493
// Additional scripting to enhance accessibility and SEO
14941494
}
14951495
```
@@ -2558,7 +2558,7 @@ JavaScript code can be embedded directly within HTML documents using the `<scrip
25582558
<script>
25592559
// Inline JavaScript code
25602560
function greet() {
2561-
alert('Hello, world!');
2561+
alert("Hello, world!");
25622562
}
25632563
</script>
25642564
</head>
@@ -2649,7 +2649,7 @@ JavaScript interacts with HTML through the Document Object Model (DOM), a hierar
26492649

26502650
<script>
26512651
function changeText() {
2652-
document.getElementById('heading').textContent = 'New Heading';
2652+
document.getElementById("heading").textContent = "New Heading";
26532653
}
26542654
</script>
26552655
</body>
@@ -2700,8 +2700,8 @@ JavaScript enables developers to handle user interactions and browser events thr
27002700
<button id="btn">Click me</button>
27012701

27022702
<script>
2703-
document.getElementById('btn').addEventListener('click', function() {
2704-
alert('Button clicked!');
2703+
document.getElementById("btn").addEventListener("click", function() {
2704+
alert("Button clicked!");
27052705
});
27062706
</script>
27072707
</body>
@@ -2723,10 +2723,10 @@ Advanced event handling techniques involve event delegation, capturing and bubbl
27232723

27242724
```javascript
27252725
// Event delegation: Handling events on parent elements for dynamically created child elements
2726-
document.getElementById('parent').addEventListener('click', function(event) {
2727-
alert('event.target.tagName is equal ' + event.target.tagName);
2728-
if (event.target.tagName === 'BUTTON') {
2729-
alert('Button clicked!');
2726+
document.getElementById("parent").addEventListener("click", function(event) {
2727+
alert("event.target.tagName is equal " + event.target.tagName);
2728+
if (event.target.tagName === "BUTTON") {
2729+
alert("Button clicked!");
27302730
}
27312731
});
27322732
```
@@ -4210,12 +4210,12 @@ The WebRTC (Web Real-Time Communication) API enables peer-to-peer communication
42104210
<script>
42114211
navigator.mediaDevices.getUserMedia({ audio: true, video: true })
42124212
.then(function(stream) {
4213-
const videoElement = document.createElement('video');
4213+
const videoElement = document.createElement("video");
42144214
videoElement.srcObject = stream;
42154215
document.body.appendChild(videoElement);
42164216
})
42174217
.catch(function(error) {
4218-
alert('getUserMedia error: ' + error);
4218+
alert("getUserMedia error: " + error);
42194219
});
42204220
</script>
42214221
```

0 commit comments

Comments
 (0)