Hi
I just started using the CKEditor(v 4.3.2) to edit web tempalte. I have button element populated through setData method. I am trying to find the clicked target but this is not working.
<form action="fileUpload.php">
<input type="button" value="Upload File" id="fileBtn" name="fileBtn" />
</form>
CKEDITOR.instances['editor1'].on('contentDom', function() {
this.document.on('click', function(event){
//alert(event.sender == document.getElementById("fileBtn"));
alert(event.sender == 'fileBtn');
});
});
Both of above alerts prints false. Is this correct way to get the sender element name?
I tried below way of getting, but that's not working -
var element = CKEDITOR.document.getById( 'fileBtn' );
element.on( 'click', function( ev ) {
alert('fileBtn clicked');
});
Thanks in advance.
To get the native event's
To get the native event's data you have to access event.data object. For example:
The event.data is the CKEDITOR.dom.event instance.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+