jQuery日本語リファレンス

jQuery does not mean Japanese Query...

Utilities/API/jQuery - Sample Code

jQuery.isFunction(obj)


            
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="/jquery/js/jquery.js"></script>
  
  <script>
  $(document).ready(function(){
    
    function stub() {
    }
    var objs = [
          function () {},
          { x:15, y:20 },
          null,
          stub,
          "function"
        ];

    jQuery.each(objs, function (i) {
      var isFunc = jQuery.isFunction(objs[i]);
      $("span:eq( " + i + ")").text(isFunc);
    });

  });
  </script>
  <style>
  div { color:blue; margin:2px; font-size:14px; }
  span { color:red; }
  </style>
</head>
<body>
  
  <div>jQuery.isFunction(objs[0]) = <span></span></div>
  <div>jQuery.isFunction(objs[1]) = <span></span></div>
  <div>jQuery.isFunction(objs[2]) = <span></span></div>
  <div>jQuery.isFunction(objs[3]) = <span></span></div>
  <div>jQuery.isFunction(objs[4]) = <span></span></div>
  
</body>
</html>
            
          
[実行結果]
[jQuery.isFunction(obj) の説明へ]