簡體   English   中英

在Google Apps腳本中使用jQuery

[英]Using jquery in google apps script

我想使用jquery使用Google Apps腳本創建應用程序。 但是我失敗了。

以下是我正在使用的示例。 一個基本的。

<!DOCTYPE html>
<html>
<head>
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">             
</script>

<script>
  $(document).ready(function() {
    $('#Hide').click(hideMe);
  });

  function hideMe(){
    this.value = 'Clicked!';
  }
  </script>

</head>
<body>
<input type="button" name="Hide" id="Hide" value="Hide me" />
</body>
</html>

這是您正在嘗試執行的工作的JSFiddle

HTML:

<input type="button" name="Hide" id="Hide" value="Hide me" />

JS:

$(document).ready(function() {
    $('#Hide').click(function () {
        $(this).val('Clicked');
    });
});

當然它也可以這樣工作,是一樣的:

$(document).ready(function() {
    $('#Hide').click(hideme);

    function hideme () {
        $(this).val('Clicked');
    }
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM