gpt4 book ai didi

javascript - 当我单击“保存”按钮时如何阻止 Jquery.TinyMCE 提交 from

转载 作者:行者123 更新时间:2023-11-30 18:27:12 27 4
gpt4 key购买 nike

每当我点击 Tinymce Editor 的 Save 按钮时,表单就会提交到服务器。我需要停止提交表单。我搜索了很多但找不到任何解决方案。这是我的代码,

$('textarea.tinymce').tinymce({
paste_retain_style_properties : "margin, padding, width, height, font-size, font-weight, font-family, color, text-align, ul, ol, li, text-decoration, border, background, float, display",
script_url : path_global+'/js/TinyMCE/tiny_mce.js',
valid_children : "+body[style]",
theme : "advanced",
plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
setup : function(ed) {
ed.onSaveContent.add(function(ed, l) {
});
}
});

更新:我找到了答案。深入研究源代码,我发现我可以在表单标签上添加 onsubmit = "return false",这将阻止表单提交。

最佳答案

我找到了答案。深入研究源代码,我发现我可以添加,

onsubmit = "return false" 

在将停止提交表单的表单标签上。

关于javascript - 当我单击“保存”按钮时如何阻止 Jquery.TinyMCE 提交 from,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10537513/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com