Need Help… How to use trigger event in backbone?

So I have a script where I am trying to trigger click event by jQuery.

Here is the syntax $( '#selector' ).trigger( 'click' ).

But that will work if the click event function is written in jQuery.

What if click event is written in backbone? How can I trigger click for that?

If anyone has idea, then please reply for this.

0 thoughts on “Need Help… How to use trigger event in backbone?”

  1. Answering to my own question.

    So jquery trigger will work for triggering backbone events.
    But for that in the backbone, we should have created that particular event which we are going to trigger.

    In my case, I was trying to submit a form by triggering the click event on the submit button.
    But in the backbone, there was no click event defined for submitting the form. It was the submit event defined in it.

    And I was trying to do: $( ‘#button_selector’ ).trigger( ‘click’ )
    So instead of it I did this: $( ‘#form_selector’ ).trigger( ‘submit’ )

    And it worked.

Leave a Reply