0
What is the purpose of variables in HTML?
Hi I'm a beginner, i don't really really understand the variable in HTML. And I don't know how it works and how it functions. I want to know more about variables and I want to understand it well too. please help me to understand it cause a lot of people use variable in coding
3 Answers
+ 3
There aren't variables in HTML, as it's a markup language, rather than a programming language. Programming languages have variables though. Web programming languages include PHP and Javascript amongst many others.
A variable is a place to store information. Example, if you were writing a program for a vending machine, you'd want to store the code the user entered (when they pressed buttons on the keypad). We could then work out which product to give them. e.g. if they typed in E4, we would store this value in a variable. This variable could then be sent to another part of the program which rotates the coils, that would make the product move forwards, and drop so the user can access their chosen product.
+ 4
HTML does not use any variables as it is a markup language and only stores information within tags. Do you mind clarifying if you mean anything else? d:
+ 2
As they said, HTML does not have variables. Even so, what if you show us where you saw that? HTML can be used together with several languages that do allow the use of variables to store information, so if you show us someone will be able to tell you more about it.