Skip to content

Commit 03add1c

Browse files
Merge pull request steam-bell-92#1121 from developer-yash03/fix/html
Fixed HTML Tags Rendering
2 parents 09d1f83 + e1a18cf commit 03add1c

6 files changed

Lines changed: 19 additions & 19 deletions

File tree

web-app/js/projects/bubble-sort.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ function initBubbleSort() {
269269
const arr = Array.from({ length: 8 }, () => Math.floor(Math.random() * 90) + 10);
270270
input.value = arr.join(' ');
271271
renderBars(arr);
272-
resultDiv.textContent = '';
273-
statsDiv.textContent = '';
272+
resultDiv.innerHTML = '';
273+
statsDiv.innerHTML = '';
274274
});
275275

276276
function sleep(ms) {
@@ -354,31 +354,31 @@ function initBubbleSort() {
354354

355355
const raw = input.value.trim();
356356
if (!raw) {
357-
resultDiv.textContent = `<p style="color:var(--danger-color)">⚠️ Please enter numbers!</p>`;
357+
resultDiv.innerHTML = `<p style="color:var(--danger-color)">⚠️ Please enter numbers!</p>`;
358358
return;
359359
}
360360

361361
const arr = raw.split(/\s+/).map(Number);
362362
if (arr.some(isNaN)) {
363-
resultDiv.textContent = `<p style="color:var(--danger-color)">⚠️ Please enter valid integers only!</p>`;
363+
resultDiv.innerHTML = `<p style="color:var(--danger-color)">⚠️ Please enter valid integers only!</p>`;
364364
return;
365365
}
366366

367367
if (arr.length < 2) {
368-
resultDiv.textContent = `<p style="color:var(--danger-color)">⚠️ Enter at least 2 numbers!</p>`;
368+
resultDiv.innerHTML = `<p style="color:var(--danger-color)">⚠️ Enter at least 2 numbers!</p>`;
369369
return;
370370
}
371371

372372
isSorting = true;
373373
comparisons = 0;
374374
swaps = 0;
375375
startBtn.disabled = true;
376-
resultDiv.textContent = `<p style="color:var(--text-secondary)">⏳ Sorting...</p>`;
376+
resultDiv.innerHTML = `<p style="color:var(--text-secondary)">⏳ Sorting...</p>`;
377377

378378
renderBars([...arr]);
379379
const sorted = await bubbleSortVisualize([...arr]);
380380

381-
resultDiv.textContent = `
381+
resultDiv.innerHTML = `
382382
<p style="color:var(--success-color); font-weight:700; font-size:1.2rem">
383383
✅ Sorted: [ ${sorted.join(', ')} ]
384384
</p>

web-app/js/projects/collatz.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function initCollatz() {
173173
let number = parseInt(numberInput.value);
174174

175175
if (!number || number < 1) {
176-
sequenceDiv.textContent = '<p style="color: var(--danger-color);">⚠️ Please enter a positive integer!</p>';
176+
sequenceDiv.innerHTML = '<p style="color: var(--danger-color);">⚠️ Please enter a positive integer!</p>';
177177
statsDiv.innerHTML = '';
178178
ctx.clearRect(0, 0, canvas.width, canvas.height);
179179
return;

web-app/js/projects/hangman.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ function initHangman() {
508508

509509
if (wrongAttempts >= maxAttempts) {
510510
gameOver = true;
511-
gameMessage.textContent = ` Game Over! The word was: <strong>${currentWord.toUpperCase()}</strong>`;
511+
gameMessage.innerHTML = ` Game Over! The word was: <strong>${currentWord.toUpperCase()}</strong>`;
512512
gameMessage.className = 'game-message lose';
513513
disableAllKeys();
514514
// Reveal word in red

web-app/js/projects/morse-code.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ function initMorseCode() {
201201
inputLabel.textContent = 'Enter Text:';
202202
textInput.placeholder = 'Type your message here...';
203203
textInput.value = '';
204-
morseOutput.textContent = '<p class="placeholder">Your translation will appear here...</p>';
204+
morseOutput.innerHTML = '<p class="placeholder">Your translation will appear here...</p>';
205205
translateBtn.textContent = '📻 Translate to Morse';
206206
}
207207
});
@@ -211,7 +211,7 @@ function initMorseCode() {
211211
inputLabel.textContent = 'Enter Morse Code:';
212212
textInput.placeholder = "Type morse code (separate letters with space, words with double spaces)...";
213213
textInput.value = '';
214-
morseOutput.textContent = '<p class="placeholder">Your translation will appear here...</p>';
214+
morseOutput.innerHTML = '<p class="placeholder">Your translation will appear here...</p>';
215215
translateBtn.textContent = '📝 Translate to Text';
216216
}
217217
});
@@ -231,11 +231,11 @@ function initMorseCode() {
231231
function translate() {
232232
const text = textInput.value.toUpperCase();
233233
if (!text.trim()) {
234-
morseOutput.textContent = '<p class="placeholder">Please enter something to translate!</p>';
234+
morseOutput.innerHTML = '<p class="placeholder">Please enter something to translate!</p>';
235235
return;
236236
}
237237

238-
morseOutput.textContent = '';
238+
morseOutput.innerHTML = '';
239239

240240
if (modeMorseToText.checked) {
241241
// Morse to Text

web-app/js/projects/prime-analyzer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ function initPrimeAnalyzer() {
225225
});
226226

227227
if (primes.length === 0) {
228-
primesDisplay.textContent = '<p style="color: var(--text-secondary);">No primes found in range</p>';
228+
primesDisplay.innerHTML = '<p style="color: var(--text-secondary);">No primes found in range</p>';
229229
}
230230
}
231231

@@ -249,7 +249,7 @@ function initPrimeAnalyzer() {
249249
});
250250

251251
if (primes.length === 0) {
252-
rangeDisplay.textContent = '<p style="color: var(--text-secondary);">No primes found in range</p>';
252+
rangeDisplay.innerHTML = '<p style="color: var(--text-secondary);">No primes found in range</p>';
253253
}
254254
}
255255

web-app/js/projects/resume-analyzer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,10 @@ function initAIResumeAnalyzer() {
296296
].slice(0, 6);
297297

298298
if (displaySkills.length === 0) {
299-
kwList.textContent = '<p style="color:var(--text-secondary);font-size:0.9rem;">No matching keywords detected. Try a .txt version of your resume.</p>';
299+
kwList.innerHTML = '<p style="color:var(--text-secondary);font-size:0.9rem;">No matching keywords detected. Try a .txt version of your resume.</p>';
300300
} else {
301301
displaySkills.forEach(({ name, pct, found }) => {
302-
kwList.textContent += `
302+
kwList.innerHTML += `
303303
<div class="resume-keyword-item">
304304
<span style="${found ? '' : 'color:var(--text-secondary);opacity:0.6;'}">${capitalise(name)}${found ? '' : ' ❌'}</span>
305305
<div class="resume-bar">
@@ -310,11 +310,11 @@ function initAIResumeAnalyzer() {
310310
}
311311

312312
const suggestionsEl = document.getElementById('resumeSuggestions');
313-
suggestionsEl.textContent = '';
313+
suggestionsEl.innerHTML = '';
314314

315315
const suggestions = buildSuggestions({ foundSkills, missingSkills, eduFound, expFound, projFound });
316316
suggestions.forEach(s => {
317-
suggestionsEl.textContent += `
317+
suggestionsEl.innerHTML += `
318318
<div class="resume-suggestion">
319319
<i class="fa-solid ${s.ok ? 'fa-check' : 'fa-triangle-exclamation'}" style="color:${s.ok ? 'var(--accent)' : 'var(--warning-color,#f59e0b)'}; margin-top:0.2rem;"></i>
320320
<p style="margin:0;">${s.text}</p>

0 commit comments

Comments
 (0)