WordPress tinymce element selector

I created a new button in tinymce editor, and I am trying to get the “a” element from tinymce editor on click, I am using

tinymce.create('tinymce.link_tracking', {
    init : function(editor, url) {
        editor.addButton('link_tracking', {
            title : 'Link tracking',
            type: 'button',
            image : '/assets/img/show.svg',
            onclick : function() {
                content = tinymce.activeEditor.selection.getContent();
                $('#link_tracking').dialog('open');

            }
        });
    }

});

this returns the element if the whole word is selected, but if I set my pointer the the element is returns a empty string, I need the functionality like the link button has.

Related posts

Leave a Reply