Reputation: 1281
I am generation dynamic content using javascript and inside that content a part will be like
onfocus="if(this.value=='Enter Email Address'){this.value='';}" onblur="if(this.value=='') {this.value='Enter Email Address';}" value="Enter Email Address"
I want above code but after generation of the content but all the single quotes are not showing properly. Please help me out. Thanks
Upvotes: 0
Views: 2056
Reputation: 227
If you're working in HTML 5 with input element, i would suggest you to look at the placeholder
attribute, as this is exactly what you are needing for. No javascript needed.
<input type="text" placeholder="Enter Email Address" />
Upvotes: 1
Reputation: 10896
try something like this , Remove backslash from double quotes,FIDDLE
<input type="text" onfocus="if(this.value=='Enter Email Address'){this.value='';}" onblur="if(this.value=='') {this.value='Enter Email Address';}" value="Enter Email Address">
Upvotes: 0