0

I used owl carousel plugin and bootstrap , what i have done so far is when you reach to last item of owl carousel it going to append a submit button instead of next button via callback i want when click on submit button do something but problem is click function not working although i used on handler but still not working.

$('#btn-submit').on('click',function(){
alert('submit clicked');
});

Sample

1 Answers1

3

The submit button is appended after attaching the event. So, delegate the event:

$(document).on('click', '#btn-submit', function(){
    alert('submit clicked');
});

Updated fiddle

Adam Azad
  • 11,171
  • 5
  • 29
  • 70
  • Thanks this works fine, and i figured out what was my problem, thanks. –  Oct 06 '17 at 08:53