I want these two effects to take place without using a function, is there any syntax ?
onkeypress="this.value=(this.value=='Password')?'' : this.value"
onkeypress="this.type='password'"
I want these two effects to take place without using a function, is there any syntax ?
onkeypress="this.value=(this.value=='Password')?'' : this.value"
onkeypress="this.type='password'"
<input type="password" placeholder="Password">
will be better suited for what you are trying to do. However, to answer your question: Just put both statements in the same handler:
onkeypress="if (this.value=='Password') this.value = ''; this.type = 'password';"
Notice that you will get problems with Internet Explorer which does not allow changing the type
of an input element. See also this answer.
Hey good question.
onclick="checkPassword();"
then have a JavaScript (with what Bergi mentioned):
var pw = document.getElementById("password");
if (pw.value=='Password') pw.value = ''; pw.type = 'password';
HTML:
<input type="password" id="password"/>