我有一个表单,我必须用trumbowyg检查textarea/ div中的元素。
$("#test").keyup(function() {
var val = $(this).val();
if (val.match(/{event_title}/g)) {
$("p.eventTagTitle").addClass("true");
} else {
$("p.eventTagTitle").removeClass("true");
}
if (val.match(/{event_form}/g)) {
$("p.eventTagForm").addClass("true");
} else {
$("p.eventTagForm").removeClass("true");
}
if (val.match(/{event_author}/g)) {
$("p.eventTagAuthor").addClass("true");
} else {
$("p.eventTagAuthor").removeClass("true");
}
});jsfiddle.net/f1m33312/3
但
在树干里不管用
jsfiddle.net/f1m33312/4
向div添加文本时trumbowyg中类似的解决方案不起作用
发布于 2016-10-01 21:27:41
Trumbowyg编辑器有特殊事件:tbwchange (来自http://alex-d.github.io/Trumbowyg/documentation.html)。
你应该换一条线
$("#test").keyup(function() {至
$("#test").on('tbwchange', function() {在小提琴上完成:http://jsfiddle.net/f1m33312/6/
https://stackoverflow.com/questions/39810238
复制相似问题