Event handler on field message

Event handler on field message

balnysbalnys Posts: 10Questions: 1Answers: 0
edited August 2013 in Editor
Hi,

I am trying to add some custom events on my editor form and make use of [quote]editor.message();[/quote] method.

I add custom element:
[code]
editor.message( 'item' , '+ Add new item' );
[/code]

And now I want add custom events on this element using class selector. Something like that:
[code]
$('.addItem').click(function (){// Add new item code });
[/code]

The problem is, I can't get working my event handlers i.e. click, hover.. Some sort of scope problems, maybe. Same problem goes with default editor selectors like [quote]div.DTE_Field_Name_{name}[/quote]. Though all before mentioned selectors works great with CSS (Cascading Style Sheets).

Maybe I've been missing something. Any thoughts are welcome.

Replies

  • balnysbalnys Posts: 10Questions: 1Answers: 0
    edited August 2013
    I got it working using:
    [code]
    $(editor.node( 'item' )).find('a.addItem').click(function (){
    // Add new item code
    });
    [/code]

    But now I came with other problem. On anchor hover I'm using bootstrap tooltip toggle:
    [code]
    $(editor.node( 'item' )).find('a.addItem').hover(function (){
    $(this).tooltip('toggle');
    });
    [/code]

    After event is triggerred something brakes and I can't get editor form to close (I have to reload page to close it). If I don't add tooltip event or don't trigger event everything works great.
This discussion has been closed.