asp.net mvc @Html. Raw effect __.net

Source: Internet
Author: User
For example, there is a string like this <font color= ' red ' > Scarlet Letter </font>

If you use @html.raw (' <font color= ' red ' > Red ' </font> '), you will see a red "red word", which will display the Html string directly (<font color= ' red ' > Red text </font>)

The problem I encountered was:

In the background I defined a variable string a= "<div><input type=" text "value=" Hello "/></div>";

And then write in JS.

var strhtml= ' @a ';

$ ("#ruleDetaile"). Append (strhtml);

The results show that the processing is: <div><input type= "text" value= "Hello"/></div>. And I think the good effect is: a text box says hello

Baffled and then asked my boss he changed to: Var strhtml= ' @Html. Raw (a) '; That's it, okay?

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.