+ 1
How to get user name ?
When we go to a website,we can see hi (my name)...how we do it for our website? Every visitors should see hi (their name)...
4 Answers
+ 2
This is common for those site which hve login/sigin feature.
They select user name from registeration page/user name and
add a function to greet with hi user name according to username-password pair/user name -emailid pair from database .
Say
When
kevinhart@gamail.com login greet "hi Kevin".
+ 2
If you can access on which sololearn id your code is opening you can also do that.
A rough idea
Document. Onload =get the I'd and then find name and alert "hi name".
Iff there is something feature like this here on sololearn
+ 1
let name = prompt('Your name?') || 'â€'; // if user writes name or â€
alert('Hi '+name); // simple JS solution
+ 1
Thanks,but i wanna show that message with his/her name every time when user log without a promt..do you have any ideas ?