Checkbox events in editor popup modal

Checkbox events in editor popup modal

PF_ForazPF_Foraz Posts: 4Questions: 1Answers: 0

Hello

I try to catch events of a checkbox in the popup modal of Editor (bootstrap). Using F12, I can see the id but the following is not working.
$('#DTE_Field_Name_Enabled_0').on('click', function () {
alert('xx');
});

The checkbox field is defined like this
{
label: currentCulture == 'de-CH' ? "Actif" : "Active",
name: "Enabled",
type: "checkbox",
separator: "|",
options: [
{ label: '', value: 1 }
],
unselectedValue: 0
}

Could you please tell me what's wrong or how to catch this event?
Thanks
Pierre

Replies

  • kthorngrenkthorngren Posts: 20,278Questions: 26Answers: 4,766

    Sounds like the checkbox #DTE_Field_Name_Enabled_0 is not in the DOM when you are creating the event handler. I would look at using the open or opened event and place the event handler code in the event.

    Kevin

  • PF_ForazPF_Foraz Posts: 4Questions: 1Answers: 0

    Thanks for the reply Kevin
    I tried both events without success...

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    Try:

    editor.field('Enabled').input().on('change', function () {
      ...
    });
    

    field().input() will get the input element.

    If that doesn't help, can you give us a link to a test case showing the issue please?

    Allan

  • PF_ForazPF_Foraz Posts: 4Questions: 1Answers: 0

    Hi Allan

    It works fine. Thanks!
    Pierre

Sign In or Register to comment.