0

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

1
  • Change ;}\" to ;}" Commented Apr 17, 2013 at 6:57

4 Answers 4

1

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" />
Sign up to request clarification or add additional context in comments.

1 Comment

Placeholder is not supported by all the browsers
0

use Escape character \

'\\'Enter Email\\''

1 Comment

But it can be '\\'Enter Email\\''
0

try this

'\'Text\''

or

"'Text'"

1 Comment

when I write \'Text\' its convert into "Text"
0

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">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.