0

I am trying to bind onpaste event to all the elements inside container, using jquery

$('.container').on("paste","*",function(e){});

But on my browser this is not working, and i think now their is no on paste event exist in jquery, So i think i must use javascript

$('.container')[0].addEventListener("paste",function(e){});

This works fine but only works for class container , how can i bind this handler to all the future created elements in container

Any idea?

beginner
  • 2,366
  • 4
  • 29
  • 53

1 Answers1

2

did you try this:

    $(".container").bind("paste", function(e){});
NewbieCoder
  • 377
  • 3
  • 16
  • By "future created element" you mean: dynamically created elements? i.e you are creating elements dynamically using JavaScript and want "onPaste" event to be bound to them? – NewbieCoder Jan 16 '17 at 11:08
  • in this u are using , on paste attribute , it may be not fit in all cases , but i think it can solve my problem – beginner Jan 16 '17 at 12:02