-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #316 from chaanakyaaM/main
profiles are sorted
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -766,6 +766,33 @@ <h3 class="name">Suramya Ranjan</h3> | |
<script type="module" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"></script> | ||
<script nomodule src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.js"></script> | ||
<script src="script.js"></script> | ||
<script> | ||
document.addEventListener('DOMContentLoaded', function () { | ||
|
||
const container = document.querySelector('.container'); | ||
|
||
const profiles = Array.from(container.querySelectorAll('.profile')); | ||
|
||
profiles.sort((a, b) => { | ||
const nameA = a.querySelector('.name').textContent.toUpperCase(); | ||
const nameB = b.querySelector('.name').textContent.toUpperCase(); | ||
|
||
if (nameA < nameB) { | ||
return -1; | ||
} | ||
if (nameA > nameB) { | ||
return 1; | ||
} | ||
return 0; | ||
}); | ||
|
||
container.innerHTML = ''; | ||
|
||
profiles.forEach(profile => { | ||
container.appendChild(profile); | ||
}); | ||
}); | ||
</script> | ||
|
||
</body> | ||
|
||
|