目录

byId()

功能

查找 ID 对应的元素。

语法

finder.byId(id)

参数

范例

Example: 指定 ID 的段落加上 css 样式。

<!DOCTYPE html>
<html>
<head>
  <style>
  p { margin: 8px; font-size:16px; }
  </style>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script>
  
  
  <script>
    require.config({
      baseUrl: "./"
      ,packages : [
         { name: "skylark", location: "../../../src/skylark" },
      ]
    });
  </script>
  
</head>
<body>
 
  <p id="target">This is a finder.byId item </p>
  <p > This is not a   finder.byId  item </p>
 
<script>
  require(["skylark/finder","skylark/styler"],function(finder,styler){
             styler.css(finder.byId("target"),"border", "2px dotted blue");
  });
</script>
 
</body>
</html>

byid.html