• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Use of % Symbols for Variable Placeholders in HTML

Q&A Forum › Category: ESP32 › Use of % Symbols for Variable Placeholders in HTML
0 Vote Up Vote Down
Bobo Gabriel asked 3 years ago

I am new to the web display of sensor readings and find in several RNT AsyncWebServer examples, that the placeholder for the variable to be inserted by code is surrounded by percentage signs (%). For example,
Here is a sample span from one of the ESP32 examples:
<span id=”humidity”>%LIGHTLEVEL%</span>
I cannot find any reference in HTML standards as to the use of this practice. It seems that the choice of using the % delimiter is more of a personal preference than a standard for identifying placeholders or a manner of formatting the replacement text. Is that correct? 

Question Tags: ESP32, ESP8266, Placeholder
3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
The placeholders with %% are just a feature of the AsyncWebServer library. It can identify placeholders between %% and replace them with whatever we want using the processor() function.
It doesn’t work like that in HTML.
Regards,
Sara

0 Vote Up Vote Down
Bobo Gabriel answered 3 years ago

Thank you, Sara! In doing some more research I also learned that the % signs are used as delimiters for placeholders because browsers are not going to interpret them as something meaningful since the % sign is not used for other purposes in HTML. 

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Yes, that’s right.
Thanks for the clarification.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.