Home > front end >  JS, according to the activated state assignment
JS, according to the activated state assignment

Time:10-21

INPUT the default value is "please INPUT your number"
If you click on the input, will be the default empty
 if (document. GetElementById (" username "). "please leave your name" value=https://bbs.csdn.net/topics/=) {
Document. The getElementById (" username "). The value="";
}

This function implements, but I think, if after clicking the INPUT, empty value, if not fill in any content, click other places, this control in the inactive state, automatic recovery "please leave your name"
 $(" # username "). The blur (function () {
If (document. GetElementById (" username "). The value)
{
Document. The getElementById (" username "). value=https://bbs.csdn.net/topics/="please leave your name";
}
}

Found useless,,,
Everybody to help me see

CodePudding user response:

$(" # username "). The blur (function () {
If (document. GetElementById (" username "). The valuehttps://bbs.csdn.net/topics/=="")
{
Document. The getElementById (" username "). The value="https://bbs.csdn.net/topics/, please leave your name";
}
}

CodePudding user response:

The use or placeholder attribute, not js