5 minute(s) read
Published on: Jun 03, 2021
Updated on: Dec 14, 2021
To be able to design a web application, you need to use a large number of programming languages; JS is the most popular among all the programming languages out there, and many programmers prefer to use it to achieve their desired goals, there are several commands in this language that need to be placed in the right place to be executed correctly, which we are going to discuss below, but before that, we need to get a little familiar with the language itself.
It is one of the programming languages that is used to control the behavior of web pages along with other languages which are used for the basic structure of web pages. To turn the page into a page that users can interact with, this language can be used for different purposes, each of which is very important, and we need to focus more on learning them in programming. By mastering this language, it is possible to implement features that are very complex on the web.
Its commands in HTML code can be placed in 3 general places, which we will mention in the following.
1. Between the... tag
2. Between the... tag
3. In the external file with an extension ".js"
- Between the... and ... tags:
Consider the following example, which is another example of it.
- In the external file with an extension ".js":
These commands can work in three ways when different codes enter them in HTML language.
- thisCan Change HTML Styles (CSS):
When this happens, the HTML attribute will change, so to understand it more, you need to consider the following example.
- this Can Hide HTML Elements:
Another thing that these commands can do on HTML elements is to hide them by displaying different elements.
- this Can Show HTML Elements:
Elements that are hidden can also be displayed.
In the above, we have mentioned the places where JS commands can be placed in general so that you can master the subject in a short while. Still, if you want to have more detailed information, we suggest you continue reading this article because other places will be mentioned below.
- between tags:
Here, the following example is given.
To understand more about this, you need to pay attention to the following example.
It may also be located as follows.
As we have mentioned at the beginning of the article, they may be located in external files, which an example will be given in the following. It should be noted that placing scripts in external files and then embedding them in HTML code causes these two types of code to be separate from each other; as a result, it makes it easier to maintain each of them as well as read them, in addition, saved JS files can speed up the loading of pages, which can be of great help to various programmers.
What is HTML?
It stands for Hyper Text Markup Language, which is a language that is often used in the design of web pages. In fact, in this language, all the code is converted to HTML and displayed by the browser. The version used these days is HTML5, so we will give you a brief description of it below.
What is HTML5?
HTML5 is the latest version of HTML that can provide many capabilities, including the ability to run images, audio, and video files which can be effective in attracting different users to the site; this version can create very high graphics for websites, the advantage of this version compared to HTML4 is that by using it, you can ensure that the content that you intend to provide is presented correctly on different devices, and also with the help of this version, another possibility is provided that without the need for additional plugins, you can provide videos and other features to the customer and reach your main goal as a web owner, which causes gaining more customers because your website will be introduced to users' friends so that you can achieve success with the help of HTML5 as soon as possible.