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
Front End Technology Articles
Page 292 of 652
How to change the shape of a textarea using JavaScript?
A textarea is an HTML element that provides a multi-line text input field with dynamic width and height. By default, textareas appear as rectangular boxes, but you can change their shape using JavaScript to modify CSS properties. In this article, we'll explore different methods to transform textarea shapes using JavaScript, including creating parallelograms and ellipses through CSS property manipulation. Using transform Property for Parallelogram Shape The transform property with skew() function can transform a rectangular textarea into a parallelogram by skewing it along the X or Y axis. Syntax element.style.transform = "skew(angle)"; ...
Read MoreHow to change the src attribute of an img element in JavaScript / jQuery?
There are different methods to change the path of an image given to the src attribute of an img element in HTML document using JavaScript and 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 ...
Read MoreHow to change the text and image by just clicking a button in JavaScript?
In JavaScript, you can dynamically change text content and images by using the onclick event with button elements. This allows for interactive web pages where content updates in response to user actions. Let us explore how to change text and images individually using JavaScript with practical examples. Changing Text of an Element JavaScript provides two main properties for modifying element text content: innerText − Changes or retrieves the plain text content of an element, ignoring HTML tags. innerHTML − Changes or retrieves the HTML content of an element, including any HTML tags within it. ...
Read MoreHow to change the text of a label using JavaScript?
The HTML tag improves web accessibility by providing clickable text descriptions for form elements. In JavaScript, you can dynamically change label text using two properties: innerHTML and innerText. Using the innerHTML Property The innerHTML property allows you to set both text and HTML markup. It's useful when you need to include formatting like bold, italics, or other HTML elements. Syntax selectedElement.innerHTML = "new text with HTML tags"; Example Change Label Text with innerHTML Original label text ...
Read MoreHow to Change the Time Interval of setinterval() Method at RunTime using JavaScript ?
The setInterval() method is used to call a particular block of code repeatedly after a specific time interval. It accepts two parameters: the function to execute and the time interval in milliseconds. Sometimes you need to change this interval dynamically during runtime for irregular or variable timing patterns. JavaScript provides two main approaches to change the time interval of setInterval() at runtime: Using the clearInterval() method Using the setTimeout() method Let us understand both approaches with practical examples. Using the clearInterval() Method The clearInterval() method stops a ...
Read MoreHow to convert JavaScript datetime to MySQL datetime?
Date time manipulation in JavaScript is important while dealing with databases. JavaScript Date and time are different from the MySQL date and time. JavaScript provides multiple ways to represent Date and time none of these formats are the same as MySQL's date and time format. In this article, we will discuss some approaches to converting JS date and time into MySQL date and time format. First of all, we will understand the difference between Javascript and MySQL date and time formats. Here is an example − Javascript − ISO 8601 Date Format: YYYY-MM-DDTHH:mm:ss.sssZ MySQL ...
Read MoreHow to convert Object's array to an array using JavaScript?
Converting an array of objects to a flat array is a common task in JavaScript. There are several approaches to extract all values from objects and create a single array containing those values. Let's understand the problem with an example: Given Array of Objects: let carObj = [ { name: "John", car: "Ford" }, { name: "Mark", car: "BMW" }, { name: "Ben", car: "Toyota" } ] Expected Output: ["John", "Ford", "Mark", "BMW", "Ben", "Toyota"] There are multiple ways to achieve this conversion: ...
Read MoreHow to convert list of elements in an array using jQuery?
We can use jQuery.makeArray() method or jQuery.each() method to convert a list of elements into an array using jQuery. The makeArray() method is the most convenient way to perform this task. This method is used to convert an object into a native array. Using jQuery makeArray() Method The $.makeArray() method in jQuery converts an array-like object into a JavaScript array. It takes a single argument and converts it to an array. Syntax $.makeArray(obj) Here obj is an object that we want to convert to an array. Example In this example we ...
Read MoreHow to convert JSON results into a date using JavaScript?
JSON is a powerful data format to exchange data from server to client and vice versa. Many times JSON data is received in a String format and we need to convert it to a usable JSON object. In this process, it's an important requirement to convert string data into Date format. In this article, we will learn how to convert JSON results into a Date string using JavaScript. The JSON objects contain the date like this − { name: "John", time: '/Date(1559072200000)/' } And the result will be − ...
Read MoreHow to convert Map keys to an array in JavaScript?
In JavaScript, you can convert a Map's keys to an array using several methods. The most common approaches are using Array.from(), the spread operator, or a for...of loop with Map.keys(). Given a JavaScript Map, the task is to extract all keys and create an array from them. Here's an example: Given Map: Map { 1 => "India", 2 => "Russia", 3 => "USA", 4 => "Japan", 5 => "UK" } Resulting Array: [1, 2, 3, 4, 5] There are multiple ways to achieve this conversion: Using Array.from() and Map.keys() method ...
Read More