简体   繁体   中英

Using jquery in google apps script

I want to use jquery to create an application using google apps scripts. But i got failed.

below is a example of what I am using. A basic one.

<!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>

Here is a working JSFiddle of what you are trying to do:

HTML:

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

JS:

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

Of course it can work also as this, it's the same:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM