I'm using the TinyMCE editor in chat and very uncomfortable to send a message by submit-button. I would like to know, how post message use "onkeypress" in TinyMCE ?
I do this so:
<script type="text/javascript">
tinyMCE.init({
...
setup : function(ed) {
ed.onKeyPress.add(
function (ed, evt) {
if(evt.shiftKey && evt.keyCode == 13) {
AjaxPost();
//alert('shift + enter key');
return;
}
});
}
...
</script>
<script type="text/javascript">
function PostAjax()
{
var Message=document.getElementById('Message').value;
$.ajax({
type: "POST",
url: "PostTinyMCE.php?Message="+Message,
success: function(html)
{
$("#General").html(html);
}
});
}
</script>
<textarea name="content" id="Message" style="width:100%"></textarea>
but it does not give me the desired effect, functions AjaxPost(); does't start, where is my mistake? Please help me...