文字列の形でコントローラーに到達する文字列があります。次の要素テンプレートを持つ List(Model.ToParticipantList) です。
string.Format("<li id=\"Id_{0}" style=\"font-weight: bold; margin-top: 1px; list-style-type: none; display: inline; margin-bottom: 3px; cursor: pointer; font-size: 11px; color: Black; padding-top: 1px; padding-bottom: 1px; margin-left: 2px; width: 150px;\"
onclick=\"RemFromList('{0}__#{2}');\">
<a>{1}</a>
</li>,", el.Id, el.Name, "To"));
これを jQuery 関数に渡して、次の結果を得たいと思います。
<li id="Id_1" style="font-weight: bold; margin-top: 1px; list-style-type: none; display: inline; margin-bottom: 3px; cursor: pointer; font-size: 11px; color: Black; padding-top: 1px; padding-bottom: 1px; margin-left: 2px; width: 150px;" onclick="RemFromList('1__#To');">
<a>System System</a>
</li>
これは機能します:
document.getElementById('To1').innerHTML=@Html.Raw(Model.ToParticipantList); //this works
// $("#To1").html('@Html.Raw(Model.ToParticipantList)'); //this doesn't
// $("#To1").append('@Html.Raw(Model.ToParticipantList)'); //this doesn't
最後の2つの例で何が間違っていますか?