0

I am using a grider.js API which helps to create a table view where I can addRow and deleteRow from the table. For this there are two methods addRow and deleteRow are used. Both these methods use .live() to perform click action. So, as now after 1.7 version jQuery doesn't support .live(), I replaced them with .on() as shown in the following screenshot? I am not getting any error in the console but click action is not working. Can you sugesst what am I doing wrong?

enter image description here

Grider API used is from the following Github URL

Grider

Kinjan Bhavsar
  • 1,439
  • 28
  • 58
  • Read the `$.fn.on()` doc for delegating event, you have to bind event to any static container and pass a selector string as parameter or read: https://learn.jquery.com/events/event-delegation/ BTW, using a plugin 9 years old doesn't sound like a great idea – A. Wolff Dec 13 '17 at 08:56
  • yes thatswhy, I changed grider.js file on my server and changed .live() to .on() but its not working. – Kinjan Bhavsar Dec 13 '17 at 08:59
  • I just tell you to read the DOC, which you obviously didn't have done... – A. Wolff Dec 13 '17 at 09:00

1 Answers1

1

Replacelive() with on() using following syntax.

$(table).on('click', 'a.delete', function() {});

I'm assuming table is already present in DOM while you add this event.

Vipin Kumar
  • 6,441
  • 1
  • 19
  • 25