我认为我有这段代码
<a href="#SampleEditor" onclick="javaScript:ShowSampleEditor()"
id="SampleLink">Add Sample</a>
<div class="editor-field" id="SampleEditor" style="display: none">
<div class="editor-label">
@Html.LabelFor(model => model.SampleCollectionInstructions)
</div>
<div class="editor-field">
@Html.TextAreaFor(model => model.SampleCollectionInstructions, new { @class = "adminRichText" })
@Html.ValidationMessageFor(model => model.SampleCollectionInstructions)
</div>
</div>
它的作用是向用户提供一个链接以打开富文本编辑器并隐藏链接
这是我使用的代码
function ShowSampleEditor() {
$("#SampleEditor").show();
$("#SampleLink").hide();
}
现在我必须为更多的编辑做这件事。由于 Json 不是我真正的东西,我怎样才能为几个编辑器创建一个通用函数来做到这一点?