0
我有一個關於在ASP.NET MVC 3中使用WYMEditor和jQuery的問題。我想在我的網頁上設置WYMEditor的默認文本。如果我以這種方式正在做:在WYMEDITOR中設置默認文本
<script type="text/javascript">
jQuery(function() {
jQuery(".wymeditor").wymeditor({ html : '<strong>some text</strong>'});
});
是沒有問題的,並且wymeditor顯示良好的格式化文本,但我嘗試以這種方式:
<script type="text/javascript">
jQuery(function() {
jQuery(".wymeditor").wymeditor({ html : '@ViewBag.HtmlText'});
});
(htmlText都將是變量,其中我保持:<strong>some text</strong>
)WymEditor顯示我沒有格式化文本<strong>some text</strong>
。我試過HtmlEncoding等,但它仍然無法正常工作。
我有不同的視圖模型,但這只是一個簡單的例子。多謝。 – jacbar
@jacbar,它工作嗎? –
是的,它的工作 – jacbar