Commit 254c78b 1 parent d160b50 commit 254c78b Copy full SHA for 254c78b
File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 690
690
< img id ="profile-avatar " src ="../images/avatar1.jpg " />
691
691
</ div >
692
692
< div class ="menu ">
693
- < h3 > XYZ< br /> < span > Book Lover</ span > </ h3 >
693
+ < h3 id =" profileNameDisplay " > XYZ< br /> < span > Book Lover</ span > </ h3 >
694
694
< ul >
695
695
< li >
696
696
< img src ="../images/user.jpg " /> < a href ="../../profile.html "> My profile</ a >
@@ -716,9 +716,19 @@ <h3>XYZ<br /><span>Book Lover</span></h3>
716
716
< script >
717
717
document . addEventListener ( "DOMContentLoaded" , ( ) => {
718
718
const savedAvatar = localStorage . getItem ( "selectedAvatar" ) ;
719
+ const savedName = localStorage . getItem ( "profileName" ) ;
719
720
if ( savedAvatar ) {
720
721
document . getElementById ( "profile-avatar" ) . src = `./assets/images/${ savedAvatar } ` ;
721
722
}
723
+
724
+ if ( savedName ) {
725
+ document . getElementById ( "profileNameDisplay" ) . textContent = `${ savedName } ` ;
726
+ } else {
727
+ document . getElementById ( "profileNameDisplay" ) . textContent = "Welcome, Guest!" ;
728
+ }
729
+
730
+
731
+
722
732
} ) ;
723
733
document . getElementById ( 'more-link' ) . addEventListener ( 'click' , function ( event ) {
724
734
event . preventDefault ( ) ;
You can’t perform that action at this time.
0 commit comments