dojo 中使用 jquery

dojo/query 不好用, 想用jquery做dom查詢, 列子如下, 注意jquery的路徑就好了

 

 

<script type="text/javascript"
  src="https://ajax.googleapis.com/ajax/libs/dojo/1.7.0/dojo/dojo.js"
  data-dojo-config="async: true, packages: [
    { name: 'jquery', location: 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1', 
      main: 'jquery' }
    ]">
</script>

The second step is to modify our source code to add the actual loading of jQuery through the require function: 
 
<script type="text/javascript">
  define.amd.jQuery = true;
  require(["jquery", "dojo/query", "dojo/NodeList-dom"], function(jquery, $){
    $("output").style("visibility", "visible");
    jquery("#output").css("visibility", "hidden");
  });
</script>

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章