Solution: standing on the shoulders of giants

Source: Internet
Author: User
In the project, JS is used to display data at the front-end. If you encounter a problem or solution, you can think about the solution.

The background transmits data to JS. js stores the obtained data in the title of the IMG tag. The problem arises, and the background data has a special character & xxxx; ("·"), in this way, the title is displayed as a character.

1. as a result, I began to search for how to use js to convert & xxxx; To "·". I found a lot of articles and did not write well. I wrote my own JavaScript escape functions to escape them, this problem is not so complicated.

2. I started to think about jquery's good method. I couldn't find it, so I gave up.

3.when the HTML text is displayed, it will be automatically escaped as the display character. So let the HTML itself turn it for me and then get the content soon? Therefore, jquery is used to fill in the HTML method of the tag with the string to be escaped, and then extract it. The obtained string has been escaped.


Summary:
Be good at solving problems with existing things and find the simplest method.

This article from the "harder, luckier" blog, please be sure to keep this source http://actor.blog.51cto.com/1764681/1440434

Solution: standing on the shoulders of giants

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.