# jQuery 1.9 .live,.delegate,.on  is not a function (ok)

```
$( selector ).live( events, data, handler );                // jQuery 1.3+
$( document ).delegate( selector, events, data, handler );  // jQuery 1.4.3+
$( document ).on( events, selector, data, handler );        // jQuery 1.7+
```

<figure><img src="https://2726517656-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M1E4Gk2ppVKb4olmnun%2Fuploads%2Fl4K1yWDCC5G8CHXVb971%2Fimage.png?alt=media&#x26;token=70eccbe0-07a2-44d5-b513-15e36a98829e" alt=""><figcaption></figcaption></figure>

C:\xampp82\htdocs\scholarsprep\wp-content\themes\kadence-child\assets\admin\js\dev-admin-custom.js

```javascript
var $ = jQuery;
$(document).ready(function () {
  $(document).on('click', '.hint-ajax__top', function(){
    alert( "Goodbye!" ); 
  });
});

```

I recently updated jQuery from 1.8 to 2.1. I suddenly discovered that the `.live()` stops working.\
I get the error `TypeError: $(...).live is not a function`.

Is there any method I can use in place of `.live()`?

* [javascript](https://stackoverflow.com/questions/tagged/javascript)
* [jquery](https://stackoverflow.com/questions/tagged/jquery)
* [function](https://stackoverflow.com/questions/tagged/function)
* [live](https://stackoverflow.com/questions/tagged/live)
* [deprecated](https://stackoverflow.com/questions/tagged/deprecated)

[Share](https://stackoverflow.com/q/14354040)Follow[edited Jun 10, 2014 at 13:03](https://stackoverflow.com/posts/14354040/revisions)[![Samuel Liew's user avatar](https://i.sstatic.net/GPiqz.png?s=64)](https://stackoverflow.com/users/584192/samuel-liew)[Samuel Liew](https://stackoverflow.com/users/584192/samuel-liew)78.4k110110 gold badges165165 silver badges273273 bronze badgesasked Jan 16, 2013 at 8:26[![ngplayground's user avatar](https://i.sstatic.net/xuvtX.png?s=64)](https://stackoverflow.com/users/1152045/ngplayground)[ngplayground](https://stackoverflow.com/users/1152045/ngplayground)21.2k3737 gold badges9797 silver badges174174 bronze badges

* 1Does this answer your question? [Turning live() into on() in jQuery](https://stackoverflow.com/questions/8021436/turning-live-into-on-in-jquery) – [djg](https://stackoverflow.com/users/5838541/djg) [CommentedSep 28, 2022 at 5:38](https://stackoverflow.com/questions/14354040/jquery-1-9-live-is-not-a-function#comment130446714_14354040)
* Related post - [Uncaught TypeError: $.ajax(...).error is not a function](https://stackoverflow.com/q/47974868/465053). `.error` is another jQuery function which got deprecated in jQuery v3.x – [RBT](https://stackoverflow.com/users/465053/rbt) [CommentedOct 7, 2022 at 9:38 ](https://stackoverflow.com/questions/14354040/jquery-1-9-live-is-not-a-function#comment130633635_14354040)

[Add a comment](https://stackoverflow.com/questions/14354040/jquery-1-9-live-is-not-a-function)

### 10 Answers

Sorted by:                                              Highest score (default)                                                                   Trending (recent votes count more)                                                                   Date modified (newest first)                                                                   Date created (oldest first)                              629

### jQuery `.live()` has been removed in version 1.9 onwards

That means if you are upgrading from version 1.8 and earlier, you will notice things breaking if you do not follow the migration guide below. You must not simply replace `.live()` with `.on()`!

***

### Read before you start doing a search and replace:

For _quick/hot fixes_ on a live site, **do not** just replace the function `live` with `on`,\
as the **parameters are different**!

```javascript
.live(events, function)
```

should map to:

```javascript
.on(eventType, selector, function)
```

**The (child) selector is very important! If you do not need to use this for any reason, set it to `null`.**

***

### Migration Example 1:

before:

```javascript
$('#mainmenu a').live('click', function)
```

after, you move the child element (`a`) to the `.on()` selector:

```javascript
$('#mainmenu').on('click', 'a', function)
```

***

### Migration Example 2:

before:

```javascript
$('.myButton').live('click', function)
```

after, you move the element `.myButton` to the `.on()` selector, and find the nearest parent element (preferably with an ID):

```javascript
$('#parentElement').on('click', '.myButton', function)
```

**If you do not know what to put as the parent, `document` always works:**

```javascript
$(document).on('click', '.myButton', function)
```

\
