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
Page 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 MoreHow can I use multiple submit buttons in an HTML form?
Generally, HTML forms use a single submit button to save or send data. However, in some cases we need multiple submit buttons such as "Save", "Update", or "Delete" within the same form. Each button may perform a different action or send data to a different URL. To handle multiple submit buttons, we can use the formaction attribute, assign the same name with different value attributes, or give each button a different name. The server-side code then determines which button was clicked and processes accordingly. Syntax Using formaction Attribute Default Action ...
Read MoreHow to validate a form using jQuery?
To validate a form using jQuery, we can use the jQuery Validation Plugin. This plugin provides a simple way to define validation rules, custom error messages, and submit handlers for HTML forms without writing complex validation logic from scratch. The plugin works by attaching the .validate() method to a form element and defining rules for each input field by its name attribute. Syntax The basic syntax for jQuery form validation is − $(document).ready(function() { $("#formId").validate({ rules: { ...
Read MoreHow to horizontally center a <div> in another?
To horizontally center a div inside another div, we need to apply CSS centering techniques on the inner element. The most common methods include using margin: 0 auto, flexbox, and position with transform. The key principle is that the inner div must have a defined width smaller than its parent, so the browser can calculate equal space on both sides to center it. Outer DIV (full width) Inner DIV (centered) auto margin auto margin ...
Read MoreHow to place two divs next to each other in HTML?
A DIV tag is a division element in HTML used to group and separate content on web pages. It helps organize text, images, navigation bars, and other elements into distinct sections. A tag consists of an opening and closing tag. Both are required. DIV elements can be styled with CSS or manipulated with JavaScript using the class or id attributes. Placing Two Divs Next to Each Other By default, elements are block-level and stack vertically. To place them side by side, we can use CSS properties like float, display: inline-block, or display: flex. ...
Read MoreWhat is the difference between height and line-height?
The height property defines the vertical measurement of an element's content area, while line-height controls the spacing between lines of text within that element. The height property sets the overall vertical size of a container, such as a div or paragraph. When content exceeds this height, it may overflow or be clipped depending on the overflow settings. The line-height property specifies the minimum height of line boxes within the element. It determines the vertical space between lines of text, affecting readability and visual spacing. Line-height can be specified in pixels, percentages, or as a unitless number (multiplier of ...
Read MoreHow to sort a set in JavaScript?
A Set is a JavaScript data structure that stores unique values in insertion order. Unlike arrays, Sets cannot be sorted directly because they don't have a sort() method. To sort a Set, we must convert it to an array, sort the array, and create a new Set from the sorted results. In this article, we'll learn different approaches to sort Sets in JavaScript using array conversion and the sort() method. Why Sets Cannot Be Sorted Directly Sets maintain insertion order and focus on uniqueness rather than sorting. They lack array methods like sort(), so we need an ...
Read MoreHow to sort an array of object by two fields in JavaScript?
An array of objects is an array that contains all the elements in the form of JavaScript objects. Here, we are said to use an array of objects with two fields that means, have to use objects with two elements as elements of the array. In this article, we are going to learn about the method of sorting the array of objects by two fields in JavaScript. We can simply use the sort() method of JavaScript to sort the elements of an array and give it a cmp or the comparator function to define the order in which we ...
Read MoreHow to select all links inside the paragraph using jQuery?
jQuery is a popular JavaScript library that simplifies HTML DOM traversal, event handling, and AJAX interactions for rapid web development. It offers a wide range of built-in functions and methods that help developers to manipulate HTML elements, styles, and behaviors dynamically. In this article, we will see how to select all links inside a paragraph using jQuery. Selecting links inside a paragraph is a common requirement when we want to modify the links in a particular section of our website, such as changing styles, adding event handlers, or extracting link information. How to Select All Links Inside a ...
Read MoreHow to sort an array on multiple columns using JavaScript?
An array with multiple columns is an array that contains multiple elements at each index position. In other words, it's an array of arrays where each sub-array represents a row with multiple column values that need to be sorted based on specific criteria. In this article, we'll learn how to sort arrays with multiple columns using JavaScript's sort() method combined with custom comparator functions. We'll explore different sorting strategies for various data types. Basic Syntax The fundamental approach uses a custom comparator function with the sort() method: array.sort((a, b) => { ...
Read More