jQuery Text Editor usage help

I am trying to use jQuery text editor. I am trying to understand how to use the events that the suppling website provides documentation. I do not know how to work with this type of code. I am not a novice to jQuery, but I will admit I am a bit rusty. However, nothing here is working for me.

I want to make the editor send a blur event when a user removes focus from it. The documentation show syntax to do so, but I cannot get it to work. When I use the syntax from this page, it does nothing for me.

<script>
	$('.jqte-test').jqte();
	
	// settings of status
	var jqteStatus = true;
	$(".status").click(function()
	{
		jqteStatus = jqteStatus ? false : true;
		$('.jqte-test').jqte({"status" : jqteStatus})
	});
	// this is way I am trying to use it:
	$('.jqte-test').jqte({blur: function(){ alert("The editor is blured"); }
    
	});
</script>

The documentation explains that this should be triggered when the editor is blurred. I must not be understanding the way this has to be implemented. Thanks for any help or suggestions

Hi @philhagen, I’m not familiar with jqte but it looks like you’re initialising the editor multiple times… you probably have to pass all options together when first calling jqte(). Does setting the status afterwards even work?

Edit: Just tried it in a fiddle and the blur option works as expected when passed initially:

When trying to call jqte() later on the same element, the editor just breaks though.

Aw man… what a help. I was pulling my hair out. Does initially have more than a trivial idea? I want to learn. You seemed to pick up what is going on off the bat. The demo page I started from does load multiple editors. I was only trying to work with one. Thanks also for asking, “Does setting the status afterwards even work?” I don’t know; I don’t even know what that was supposed to do. I am not working in JavaScript or jQuery in the usual way here. What I am doing is for use in a FileMaker solution via the WebViewer. Once I have got the blur firing, I can do what I need to do. Thanks so much!

Ah yes the page explains the options one by one, but eventually they have to be gathered as required… e.g.

$('textarea').jqte({
  status: true,
  blur: function () {
  	$('body').append('<div>blur</div>')
  }
})

As for the status option, it just seems to not initialise the editor at all when set to false. ¯\_(ツ)_/¯ Anyway, glad I could help! :-)

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.