$(document).ready() works but $.ready() does not

时间:2017-06-07 04:47:46

标签: jquery

$(document).ready( function(){
    $(document).on('click', 'a[data-iframe-menu-entry="data-iframe-menu-entry"]', function(event) {
        alert('hola');
....

vs

$.ready(function() {
    $(document).on('click', 'a[data-iframe-menu-entry="data-iframe-menu-entry"]', function(event) {
        alert('hola');
....

$.ready() is supposed to be an alias, but it does not work for me. What is wrong?

1 个答案:

答案 0 :(得分:1)

正确的别名形式是:

$(function() {
   // Your code 
});