Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html tag beginning with question mark?

I'm learning google apps script, and in this tutorial, I saw some weird looking syntax: <? /* JS code */ ?> and <?= /* JS code */ ?>

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <title>Message Display Test</title>
    <link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
  </head>
  <body style="padding:3em;">
  <h1>Messages</h1>
    <ul>
    <? for(var m=0;m<messages.length;m++){ ?>
    <li><?= messages[m].getSubject() ?></li>
    <p><?= messages[m].getPlainBody() ?></p>
    <? } ?>
    </ul>
  </body>
</html>

I can kind of understand what is going on, but I'm still confused. I've never seen these while learning HTML. How does this compare to script tags?

like image 892
Paradox Avatar asked Apr 30 '26 06:04

Paradox


1 Answers

In Google Apps Script <? . . .?> are called standar scriptlets, <?= . . . ?> are printed scriptlets and <?!= . . . ?> are force printing scriplets. They are used in Google Apps Script HTML Service templated HTML.

Resource

  • https://developers.google.com/apps-script/guides/html/templates

Related

  • How to use scriptlets in HTMLOutput in Google Apps Script
  • What does <?!= mean in Google Apps Script?
like image 117
Rubén Avatar answered May 02 '26 19:05

Rubén



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!