Found 10710 Articles for Web Development

How to change the value of a global variable inside of a function using JavaScript?

Abhishek
Updated on 17-Feb-2023 11:44:02

4K+ Views

There are two types of variables can be declared in any programming languages in context of their accessing scope. The Local variable and the Global variable. Global Scoped Variables − The global scoped variables are the variables which are declared globally inside the code file and can be accessed by any code block or any function inside the file. The scope of these variables is global. Local Scoped Variables − These are the variable, which declared inside a function or a particular block of code and can only be accessed or used within that particular block of code not outside ... Read More

How to align an item to the flex-end in the container using CSS ?

Diksha Patro
Updated on 09-Nov-2023 14:38:15

1K+ Views

In CSS, the use of aligning items to the flex-end in a container using CSS is to position the items at the end of the container's main axis. This allows for more precise control over the layout of the items within the container, such as aligning items to the bottom of a header or the right side of a navigation bar. Additionally, aligning items to the flex-end can improve the overall visual design and user experience of the website or application by creating a clean and organized layout. Approaches We have three different approaches for aligning the item baseline ... Read More

How to Change the Time Interval of setinterval() Method at RunTime using JavaScript ?

Abhishek
Updated on 17-Feb-2023 11:57:00

2K+ Views

The setInterval() method is used to call a particular block of code again and again after a particular interval of time that is given to it in its round braces as parameter. The setInterval() method accepts two parameters, the first is the code that has to be executed again and again while the second is the time in which the code has to be execute again. In this article, we are going to learn about the methods of changing the time interval of the setInterval() method at the runtime. So that, it will execute the given code at the irregular ... Read More

How to align an item set to its default value in CSS?

Diksha Patro
Updated on 17-Feb-2023 10:51:21

562 Views

In CSS, aligning an item to its default value means ensuring that the item maintains the alignment specified by the parent container's "align-items" property. The default value for "align-items" is "stretch" but you can set it to other values like "center", "flex-start" and so on. Approaches We have three different approaches for align an item set to its default value in CSS include − Using the “align-items:stretch” Using the “align-self:auto” Using the ”vertical-align:baseline” Approach 1: Using the"align-items:stretch" The first approach for aligning an item set to its default value in CSS is the "alignitems:stretch" property in CSS ... Read More

How to change the text of a label using JavaScript?

Abhishek
Updated on 17-Feb-2023 11:55:49

5K+ Views

Before going to learn about the method of changing the text of a label element in HTML document, let us understand what is the label tag itself? The label tag helps in improving the usability of the web page for mouse users, as it can toggle the text inside it if the user clicks on it. Let us now discuss about the methods of changing the text of the label element using JavaScript. JavaScript allow us to use two inbuilt properties to change the text of any element in the HTML document, as listed below − Using the innerHTML ... Read More

How to change the text and image by just clicking a button in JavaScript?

Abhishek
Updated on 17-Feb-2023 11:54:44

19K+ Views

The text given to an particular element and the image given in an img element can be easily changed using the JavaScript. We can use the onclick event with the button element in the HTML document to make this happen when the button is clicked. To change the text on click to the button we assign a function to the onclick event as the value which performs the required changes. Let us understand the methods of changing the text and the image individually using JavaScript in details with the help of code examples. Changing text of an element JavaScript provide ... Read More

How to change the src attribute of an img element in JavaScript / jQuery?

Abhishek
Updated on 17-Feb-2023 11:53:22

14K+ Views

There are different methods to change the path of an image given to the src attribute of an img element in HTML document using the JavaScript as well as jQuery. Method of changing the src attribute of an img element using JavaScript − Use the src property in JavaScript. Methods of changing the src attribute of an img element using jQuery − Using attr() method Using prop() method Let us discuss each of the above listed methods of changing the src of an img element one by one in details − Using src property in JavaScript ... Read More

How to Add Image into Dropdown List for each items?

Diksha Patro
Updated on 17-Feb-2023 16:06:15

6K+ Views

Creating a dropdown list with images can be a great way to make your website or application more visually appealing and user-friendly. In this article, we will go through a step-by-step example of how to add an image to each item in a dropdown list using HTML and CSS. Approach We will go through a step-by-step process of creating an HTML file with the necessary elements, using CSS to style and position those elements, and using the :hover selector to change the appearance of the elements when the user interacts with them. By the end of this article, you ... Read More

How to change the shape of a textarea using JavaScript?

Abhishek
Updated on 17-Feb-2023 11:51:52

308 Views

Textarea is a type of box with dynamic width and height, that means when the text is entered inside it, the text will not overflow and will only be contained by this texarea as it can dynamically increase or decrease its height and width. The textarea is mainly used inside the forms to get the full address of user and some other content with a larger text content. Commonly, A textarea is in the form of square shape or the rectangular shape, which can be changes using JavaScript as well as CSS. In this article, we are going to learn ... Read More

How to change the ID of the element using JavaScript?

Abhishek
Updated on 17-Feb-2023 11:49:19

3K+ Views

Generally, the ID given to any element in an HTML document is unique and can be assign to an element only once. But it is possible to change that id later using the JavaScript following the same rule of uniqueness for new ID as well as only single element can contain the new ID. In this article, we are going to learn about the ways of changing the ID of an element using JavaScript. JavaScript provides us or allow us to use the id property to get the id of any element as well as to change or add a ... Read More

Advertisements