Found 8895 Articles for Front End Technology

How to dynamically get the content height of a div using AngularJS?

Dishebh Bhayana
Updated on 03-Aug-2023 21:06:20

646 Views

In this article, we will explore how to dynamically get the content height of a HTML element using AngularJS, using its getContentHeight() function. In web development, there are often situations where we need to dynamically determine the height of a element based on its content. We can easily implement it with the help of AnguarlJS, a popular javascript framework, and the various utility functions provided by it. Let’s understand how to implement the above with the help of some examples. Example 1 In this example, we will add an ng-init="getContentHeight()" to the element, which calls the getContentHeight() ... Read More

How to dynamically create new elements in JavaScript?

Dishebh Bhayana
Updated on 03-Aug-2023 21:02:04

1K+ Views

In this article, we will learn how to dynamically create new elements in JavaScript with the help of the createElement browser API. Dynamic element creation in JavaScript allows you to generate new HTML elements on the get-go. Whether you need to add content to a web page based on user interactions or dynamically generate elements for a specific task, it can help enhance the flexibility and interactivity of web applications. Let’s understand how to implement this with the help of some examples. Example 1 In this example, we will have a button element and on clicking it, we ... Read More

How to Dynamically Add/Remove Table Rows using jQuery?

Dishebh Bhayana
Updated on 03-Aug-2023 20:58:46

2K+ Views

In this article, we will learn how to dynamically add or remove table rows using jQuery, a popular JavaScript library, with the help of the click event listeners. Tables are a commonly used element in web development, especially when dealing with tabular data or dynamic content. Adding or removing table rows dynamically can be a powerful feature that allows users to interact with the data in real time. Let’s understand how to implement this with the help of some examples. Example 1 In this example, we will have an HTML table element with some row data in it. ... Read More

How to Draw Smooth Curve Through Multiple Points using JavaScript?

Dishebh Bhayana
Updated on 03-Aug-2023 20:39:58

488 Views

In this article, we will learn how to draw smooth a curve through multiple points using JavaScript with the help of canvas browser API and HTML element. When it comes to visualizing data or creating interactive graphics on the web, drawing smooth curves through multiple points can greatly enhance the aesthetics and readability of the information. Let’s understand how to implement this with the help of some examples. Example 1 In this example, we will leverage the concept of Brazier Curves which are defined by a set of control points to draw a smooth curve passing through them. We will ... Read More

How to display a warning before leaving the web page with unsaved changes using JavaScript?

Dishebh Bhayana
Updated on 03-Aug-2023 20:36:12

1K+ Views

In this article, we will learn how to display a warning message before leaving the web page with unsaved changes using javascript with the help of the “beforeunload” event listener. When working on web applications or forms of any kind, it becomes necessary to provide a warning message to users before they leave a page with unsaved changes. This can prevent accidental data loss and improve the overall user experience. Let’s understand how we can implement this with the help of some examples − Example 1 In this example, we will have a form with multiple input elements and ... Read More

How to display the tag name of the clicked element using jQuery?

Dishebh Bhayana
Updated on 03-Aug-2023 19:22:24

214 Views

In this article, we will learn how to display the tag name of the clicked element using jQuery, and with the help of click event listeners. jQuery is a popular JavaScript library that makes it easy to manipulate HTML elements on a web page or listen to user actions like click events and do some operation based on that action.. Let’s understand how we can achieve the above with the help of some examples. Example 1 In this example, we will add a heading, some text, and a list of items to the HTML document. And to display the ... Read More

How to Display Spinner on the Screen till the data from the API loads using Angular 8?

Dishebh Bhayana
Updated on 03-Aug-2023 19:17:55

576 Views

In this article, we will learn how to display a spinner on the screen till the data gets loaded from an API, using Angular 8 and the HTTPClient service to fetch data from a dummy todos API. Angular 8 is a robust framework for building web applications. It offers many features that make creating dynamic and interactive user interfaces easy. Let’s use the framework and understand how to show a spinner component conditionally using an example. Prerequisites Before proceeding with the steps below, please ensure you have angular CLI installed on your systems, as we would be relying ... Read More

How to display a popup message when a logged-out user tries to vote?

Dishebh Bhayana
Updated on 03-Aug-2023 19:09:26

72 Views

In this article, we will learn how to display a popup message when a logged-out user tried to vote using jQuery and its various methods. In many web applications, it is important to restrict certain actions to logged-in users only, for example, voting on a poll or a form. To implement this functionality, we will use the jQuery library and some basic HTML and CSS. We will show a popup message that informs the user that they need to be logged in to perform the desired action. Let’s understand the above approach with the help of an example − ... Read More

How to display logged-in user information in PHP?

Dishebh Bhayana
Updated on 03-Aug-2023 18:59:08

1K+ Views

In this article, we will learn how to display logged-in user information using PHP and its various inbuild methods. When building a web application that requires authentication, it is often necessary to display the logged-in user's information on various pages. This could be useful in applications such as e-commerce websites, banking websites, and more. We can implement this with the help of PHP and its functions. Let’s understand this with the help of some examples. Example 1 In this example, we will create a login/logout system wherein the user will get authenticated once he is logged in, and will ... Read More

How to display errors without an alert box using JavaScript?

Dishebh Bhayana
Updated on 02-Aug-2023 20:16:29

936 Views

In this article, we will learn how to display errors inline on a page and without an alert box using javascript with the help of innerHTML and textContent properties of HTML DOM elements. While alert boxes can be useful for displaying errors to users, they can be disruptive and interrupt the user experience. A more elegant solution is to display errors inline on the page. Let’s understand how to achieve the above result with the help of 2 approaches Approach 1 In this approach, we will use the innerHTML DOM element property to display the error message inline in ... Read More

Advertisements