Found 10483 Articles for Web Development

How to strip out HTML tags from a string using JavaScript?

AmitDiwan
Updated on 22-Nov-2022 06:44:33

811 Views

We can strip out HTML tags from a string with JavaScript using the following examples − Strip out HTML tags using Regex Strip out HTML tags using InnerText Strip out HTML tags using Regex The regex will identify the HTML tags and then the replace() is used to replace the tags with null string. Let’s say we have the following HTML − The tags stripped...)/ig, ''); } The call for the above function to remove tags goes like this − document.write(removeTags('The tags stripped...

Center image using text-align center with CSS

AmitDiwan
Updated on 30-Oct-2023 14:31:57

2K+ Views

The text-align center is generally used to center text of an element. However, we can also center an image using the same text-align property. First, let us see how to center align a text, then we will center an image using the text-align. Additionally, we will also align an image horizontally and vertically as well. Center a Text Using the Text-align Property in CSS Let us first see how to center a heading using the text-align property − h1 { text-align: center; } Example Let us now see the example to center a text on ... Read More

How to Detect User Timezone in PHP?

AmitDiwan
Updated on 22-Nov-2022 06:26:55

6K+ Views

To detect timezone, we can either set a timezone and display or we can directly display. Here, we will see two examples − Get and Display the default timezone. Set a Timezone and Display it. Get the Default TimeZone To get the default timezone in PHP, we will use the following method − date_default_timezone_get(); Example Let us see the example − Output Default TimeZone:UTC Set a TimeZone and Display In this example, we will first set a timezone using the following method − date_default_timezone_set To get the timezone we have ... Read More

How to Detect User Timezone in JavaScript?

AmitDiwan
Updated on 13-Sep-2023 04:03:31

49K+ Views

To detect the user timezone with the name of the timzone itself, use the Internationalization API. This gives the name of the Timezone in which the user and the browser is being worked on. Detect Exact Timezone with Name Example To get the exact timezone name, we will use the Internationalization API − DOCTYPE html> Timezone document.getElementById("test").innerHTML = Intl.DateTimeFormat().resolvedOptions().timeZone; Output Get the Timezone (Difference between UTC ... Read More

How to Only Allow Numbers in a Text Box using jQuery?

AmitDiwan
Updated on 22-Nov-2022 05:45:15

14K+ Views

We can easily allow only numbers in a textbox using jQuery. Under the keyup() set the code for allowing only number values so that the textbox never accept strings. We will see two examples − Allow Only Numbers in a TextBox using jQuery replace() Allow Only Numbers in a TextBox using jQuery fromCharCode() Allow Only Numbers in a TextBox using jQuery replace() In this example, we will see how to allow only numbers in a TextBox using jQuery replace(). We must set the code under the keyup to allow only numbers while typing, else the textbox will not ... Read More

What are the basic rules for JavaScript parameters?

Shubham Vora
Updated on 15-Nov-2022 11:09:40

457 Views

In this tutorial, let us discuss the basic rules for JavaScript parameters. A JavaScript function is a code that performs a particular task. The function parameters are the name list in the function definition. Parameters are also known as formal parameters or formal arguments. We can follow the syntax below to declare parameters. Syntax function functionName(param1, param2) { } When there is no value for a parameter, a default value comes in place. Rules Declare the default parameters as the final ones to avoid an error. The JavaScript function definition does not specify a parameter type. The JavaScript ... Read More

Video.js Player Method / Options References

Prince Yadav
Updated on 04-Apr-2023 13:59:38

1K+ Views

In this tutorial, we’re going to go through some of the basic options references of video.js. Option References are like settings to control or modify the behavior of a video player. These options can be both − HTML5 options like autoplay, reload, etc., and video-js specific settings. We’re going to have a look at each of these alternatives. Standard HTML5 Element Options Standard HTML5 Element Options are standard settings which work both with tag and tag. With the help of these options, you can change the video player’s height, width, controls, etc. Let’s discuss some of ... Read More

Playing an MP3 with Video.js player

Prince Yadav
Updated on 18-Jan-2023 14:26:39

3K+ Views

In this tutorial, we're going to learn how to play an mp3 file or an audio file using the video.js player. Playing an mp3 file using video.js is somewhat similar to playing an audio file in standard HTML5 but a few additional steps are required for video.js to support an mp3 file. Advantages of using playing mp3 files using video.js Using video.js to construct an mp3 player will provide you with more control over the audio file. All of the video.js-specific functions can be used on the audio, allowing for more flexibility. How to Play Mp3 with video.js Player? To ... Read More

How to setup Video.js with Vue.js?

Prince Yadav
Updated on 11-Nov-2022 07:22:46

4K+ Views

Video.js is a modern web video player which supports a lot of standard video playback formats along with the latest playback video formats. Video.js is very popular for creating video players and has large community support. One of the greatest things about video.js is that it is very straightforward to import and use in your project. It also provides support for various popular frameworks like React.js, Vue.js, and Angular.js In this tutorial, we’re going to have a look at how to set up video.js with the vue.js framework. We’ll also implement a basic example to create a video player using ... Read More

How to setup Video.js with ReactJS?

Prince Yadav
Updated on 11-Nov-2022 07:21:22

5K+ Views

Video.js is a simple, straightforward, and easy-to-use modern video player which lets supports a video variety of video playback formats like mp4, FLV, etc. as well as modern formats like video playback formats like YouTube, Vimeo, flash, etc. The best thing about video.js is that is very easy to import and use in our project. In this article, we're going to see how to use the video.js library in our React project with the help of a few examples. How to setup Video.js with ReactJS? For using video.js in our project with react.js, we first need to create a react ... Read More

Advertisements