0

the Input Box has a value Hanako&#60;. after I call the jquery to get value, It alert Hanako<. I want to alert Hanako&#60;

Jquery code:

var chk_val_2 = $('#txt_rename' + chk_check).val();
alert (chk_val_2);

Please Help me.

2
  • jQuery is changing the order of * and <? I doubt it. Commented May 16, 2013 at 3:47
  • jsfiddle demo please Commented May 16, 2013 at 3:49

1 Answer 1

1

Is your HTML like this:

<input id="txt_rename123" type="text" value="Hanako&#60;">

HTML replaces entities in attribute values, so if you want a literal & you have to write:

<input id="txt_rename123" type="text" value="Hanako&amp;#60;">

FIDDLE

Sign up to request clarification or add additional context in comments.

2 Comments

I have a question. My database is store this string which is "Hanako&amp;#60;". True or Not?
Yes. If you always want to show entities explicitly, you have to store them literally.

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.