To use TinyMCE, I have to paste this line of js code
tinymce.init({ selector:'textarea' });
but I am using my custom script which is targeting to the same textarea , now both textarea conflicting each other and TinyMCE blocking my script to execute, I am not getting any error, but when I comment out the TinyMCE script, my script works fine again.
This is the HTML code
<textarea name="content" class="form-control" id="content" cols="30" rows="10"></textarea>
This is my custom js code
$(document).on('keydown blur keyup', '.form-control', function(event) {}
// form control is the class name of the textarea.
Try to use
tinymce.init({ selector:'.#content' });
nope not working, u have added “.” operator but I tried without . and still doesn’t work
tinymce.init({ selector:'#content' });
I used TinyMCE CDN
<script src="//tinymce.cachefly.net/4.0/tinymce.min.js"></script>
in the live weave with this code
<!DOCTYPE html>
<html>
<head>
<title>HTML5, CSS3 and JavaScript demo</title>
<script src="//tinymce.cachefly.net/4.0/tinymce.min.js"></script>
</head>
<body>
<!-- Start your code here -->
<p class="lw">Hello Weaver!</p>
<textarea name="" id="content" cols="30" rows="10">
</textarea>
<script>tinymce.init({ selector:'#content' });</script>
<!-- End your code here -->
</body>
</html>
and the tinymce works fine as it seen
I am also using CDN and it is showing but now my script is not working, here is my full js code
$(function() {
$(document).on('keydown blur keyup', '.form-control', function(event) {
var target = $(this).attr('id');
target = $('#' + target + '-countdown');
var max = target.attr('title');
if (event.type == 'keydown') {
var len = $(this).val().length;
var remain = max - len;
if (len > max) {
var val = $(this).val();
$(this).val(val.substr(0, max));
remain = 0;
}
target.html(remain);
} else {
if ($(this).val() === '') {
target.html(max);
}
}
});
});
system
Closed
May 5, 2017, 2:30pm
6
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.