我尝试用radobutton显示/隐藏tinymce。像是/否。所以有两个单选按钮。是的 - 会显示微小的mce,否则会隐藏tinymce。用单选按钮显示/隐藏tinymce
我有这样的:
出微小的MCE:
<div class="form-group">
@Html.Label(Resources.Entity.Product.PdfMessage, new { @class = "text-bold control-label col-md-2" })
<div class="col-lg-6 col-md-8 col-sm-10 ">
@Html.EditorFor(model => mailModel.PdfMessage, new { htmlAttributes = new { @class = "form-control tiny-mce", data_lang = System.Globalization.CultureInfo.CurrentUICulture.Name, id = "tinyMCE" } })
@Html.ValidationMessageFor(model => mailModel.PdfMessage)
@*@Html.TextArea("MailProductHandlers_message", mailModel.Message, new { @class = "form-control", @rows = 15 })*@
</div>
</div>
这些都是我的单选按钮:
<div class="form-group">
@Html.Label(Resources.Entity.Product.GeneratePDF, new {@class = "text-bold control-label col-md-2" })
<div class="col-lg-6 col-md-8 col-sm-10 ">
@Html.Label(Resources.Entity.Product.GeneratePDFYes) @Html.RadioButtonFor(model => model.IsChecked, "Yes", new { @checked = true, id = "radioButton" })
@Html.Label(Resources.Entity.Product.GeneratePDFNo) @Html.RadioButtonFor(model => model.IsChecked, "No", new { @checked = true, id = "radioButton2" })
</div>
</div>
,这是我的javascript:
<script>
$(document).ready(function() {
$("input[Id='radioButton']").click(function() {
if ($(this).is(':checked')) {
$('#tiny-mce').show();
}
else {
$('#tiny-mce').hide();
}
});
});
</script>
如果我这样做:$('#mceu_61').hide();
它隐藏了编辑器。但是当我按是时,它显示编辑器。但如果我然后按否,它不再隐藏。我有这样的:
@Html.EditorFor(model => mailModel.PdfMessage, new { htmlAttributes = new { @class = "form-control tiny-mce", @id = "mceu_61", data_lang = System.Globalization.CultureInfo.CurrentUICulture.Name } })
什么是你的问题检查检查上改变事件? –
这不起作用。它不显示/隐藏 – InfinityGoesAround
我想你想要@id –