I am not able to get jQuery alerts to work in my GAS project. I am able to include the basic jquery library like this:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
However, if I try to include these for using jAlert:
<script src="https://jquery.alerts.js" type="text/javascript"></script>
<link href="https://jquery.alerts.css" rel="stylesheet" type="text/css">
I get an error saying: "net::ERR_NAME_NOT_RESOLVED" in console.
How do I include the jquery alerts library for use in GAS?
Note: Is jquery.alerts.js website active? I don't see any content there (I am new to this. I don't know if this website is supposed to exist or no).
You can add jquery.alerts source on you google apps script project. In Google apps script project create html file jquery.alerts.css.html and put in it source code in tag style like
<style>
popup_container {
font-family: Arial, sans-serif;
font-size: 12px;
min-width: 300px; /* Dialog will be no smaller than this */
/*...and other code*/
</style>
Than create html file jquery.alerts.js.html and put in it source code in tag script like
<script type="text/javascript">
(function($) {
$.alerts = {
verticalOffset: -75,
horizontalOffset: 0,
repositionOnResize: true,
/*...and other code*/
</script>
Then when you can use this library with html service. Example:
<html>
<?!= include('jquery.alerts.css.html'); ?>
<?!= include('jquery.alerts.js.html'); ?>
<head>
<base target="_top">
</head>
<body>
<div>
<a href="http://google.com">Click Me!</a>
</div>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With