This content originally appeared on DEV Community and was authored by somen das
So it's time to stop the meme that HTML is not a programming language. i just added support to HTML5 of for loops
if else conditions.
template inclusions.
automatic State rebuild on variable change.
lot's of things nowadays they have in bloatwares like react.
check it out on guthub under KTBsomen/httl-s
To use this library, simply include the script in your HTML file after the body tag this should be loaded at last after defining all custom components
:
<script src="https://cdn.jsdelivr.net/gh/KTBsomen/httl-s@main/statejs.js"></script>
<for-loop array="[1, 2, 3]" valueVar="item" indexVar="index" loopid="loop1">
<template loopid="loop1">
<p>Index: ${index}, Value: ${item}</p>
</template>
</for-loop>
<condition-block ifid="condition1">
<if-condition value="5" eq="5" elseid="conditionElse">
<p>Condition is true!</p>
</if-condition>
<else-condition elseid="conditionElse">
<p>Condition is false!</p>
</else-condition>
</condition-block>
This content originally appeared on DEV Community and was authored by somen das

somen das | Sciencx (2025-06-07T03:38:31+00:00) I added if-else & loops in HTML5. Retrieved from https://www.scien.cx/2025/06/07/i-added-if-else-loops-in-html5/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.