You can use the .ready () event for tags other than the document

Can the .ready () event be used in tags other than the document? Example:

$("#test").ready(function() {
  $("#test").click(function () {
    alert("test");
  });
});
+5
source share
3 answers

Quote .ready()documentation page :

The method .ready()can only be a jQuery object call corresponding to the current document


The selector can be omitted, but it will not change anything: it will still work on the document.

+10
source

$( "# test" ). ready , , #test dom . @ZeSimon , , #test dom. ajax, dom , click .

a > 0 , #test , , .

#test ajax,

  • live ('click') [ ajax]

+1

, , $(document).ready(), ?

0

All Articles