0

In my application, I have used modal popup of jquery.I have developed the ng-bootstrap modal pop using this link as reference.

I have a js file where button click event is handled.
If I place my button in app.component.html, the jquery event is fired when button is clicked. But if I put the same button on modal popup, the event is not fired.

I want the event to be fired when I click the button on modal popup as well.

James Z
  • 12,209
  • 10
  • 24
  • 44
CrazyCoder
  • 2,194
  • 10
  • 44
  • 91

1 Answers1

0

make sure you are using this way

$(document).ready(function() {
   $(document).on("click","#item", function(){
     console.log(1);
   }
 }

$('#item').click() will not work here.

Haseeb A
  • 5,356
  • 1
  • 30
  • 34
  • Thanks a lot!! Could you also tell me how to close/hide the popup in this event? – CrazyCoder Mar 04 '18 at 10:23
  • without seeing your code i am afraid i can't give details on closing/hiding . may be this will help https://stackoverflow.com/a/44269431/7477198 – Haseeb A Mar 04 '18 at 10:42