Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
Should I write my script in the body or the head of the HTML?
In HTML, the script tag can be placed either in the section or in the section. The location affects when the script executes and how it interacts with page elements. Understanding the differences helps you choose the optimal placement for your JavaScript code. Syntax Following is the basic syntax for embedding JavaScript in HTML − //JavaScript code here You can place multiple script tags in an HTML document, and they can appear in the , , or both sections. Script in Head Section When scripts ...
Read MoreHow to use external “.js” files in an HTML file?
External JavaScript files are .js files containing JavaScript code that can be linked to HTML documents using the tag with the src attribute. This approach separates JavaScript code from HTML markup, making code more organized, reusable, and maintainable. Syntax Following is the syntax to link an external JavaScript file to an HTML document − The src attribute specifies the path to the external JavaScript file. The path can be relative (within your project) or absolute (full URL to external resources). Creating an External JavaScript File An external JavaScript file is ...
Read MoreWhat is the difference between id and name attributes in HTML?
The id and name attributes in HTML serve different purposes. The id attribute uniquely identifies an element for CSS styling and JavaScript manipulation on the client side, while the name attribute identifies form data sent to the server as name-value pairs in the HTTP request. Syntax Following is the syntax for using the id attribute − Content Following is the syntax for using the name attribute − The id must be unique within the document, while the name can be shared across multiple elements (e.g., radio buttons in the ...
Read MoreWhat are valid values for the id attribute in HTML?
The ID attribute in HTML is a unique identifier for an element. It helps in identifying a specific area on a web page for CSS styling, JavaScript targeting, and anchor linking. Let us first see the common uses of the ID attribute in HTML − Script reference − In JavaScript, we use the ID attribute to select and manipulate a specific element on the page using methods like getElementById(). CSS selector − The ID is used as a selector with the # symbol to apply styles to a single specific element on the page. ...
Read MoreAre HTML comments inside script tags a best practice?
Before trying to understand whether HTML comments inside script tags is a best practice or not, let us first discuss how comments work in HTML and the different ways to use them. Comments are helpful for understanding code, leaving reminders, and providing explanations. They also help in disabling statements temporarily when testing or working on a new feature. The browser ignores everything inside a comment tag and does not render it on the page. HTML Comment Syntax Following is the basic syntax for writing an HTML comment − The comment starts with ...
Read MoreWhere should I put tags in HTML markup?
JavaScript code in HTML is placed between and tags. You can place them inside the , within the , or just before the closing tag. The recommended approach is placing scripts before so page content loads first. The tag tells the browser to interpret the content as a script. The type="text/javascript" attribute is optional in modern browsers as JavaScript is the default. Where to Place Tags In Loads before page renders In ...
Read MoreWhat is CDATA in HTML?
The full form of CDATA is Character Data. It is a section in XML used to include blocks of text that should be treated as raw character data, not as markup. The XML parser does not parse the content inside a CDATA section, so tags and entities within it are ignored. A CDATA section starts with and ends with the delimiter ]]>. Everything between these markers is treated as plain text. CDATA sections cannot be nested. In HTML, CDATA sections are not used − browsers treat them as comments and do not display them. CDATA is primarily ...
Read MoreWhich is the best tutorial site to learn HTML?
HTML stands for Hyper Text Markup Language, which is the most widely used language on the web to develop web pages. HTML was created by Tim Berners-Lee in late 1991, and "HTML 2.0" was the first standard HTML specification published in 1995. HTML 4.01 was a major version published in late 1999. The current version is HTML5, which is an extension of HTML 4.01 and was officially published in 2012. What Does HTML Look Like? HTML uses a system of tags to structure content on a web page. Here is a basic example of an HTML page − ...
Read MoreStatic HTML elements are written directly in SAPUI5
SAPUI5 allows developers to use their own static HTML elements alongside UI5 controls. It is not a closed framework − you can use the sap.ui.core.HTML control to write plain HTML within any area rendered by UI5, making it easy to mix static HTML and UI5 controls in the same view. HTML created by UI5 controls is generated dynamically at runtime. This is how most JavaScript UI libraries work when providing higher-level UI elements that would be complex to write in static HTML alone. However, SAPUI5 gives you the flexibility to embed your own static HTML whenever needed. ...
Read MorePage build in HTML and wanted to load into JS view in SAPUI5 application.
In SAPUI5, you may need to load an HTML page into a JavaScript view. This is useful when you have pre-built HTML content that needs to be displayed within a SAPUI5 application. There are multiple ways to achieve this, including using sap.ui.core.HTML with an iframe, loading HTML content via an AJAX call, or directly embedding HTML content. Syntax Using sap.ui.core.HTML with iframe new sap.ui.core.HTML({ preferDOM: true, content: "" }); The sap.ui.core.HTML control allows you to embed raw HTML content into a SAPUI5 view. Setting preferDOM: true tells the ...
Read More