Javascript Articles - Page 513 of 534

How to edit a JavaScript alert box title?

Vrundesha Joshi
Updated on 08-Jan-2020 10:57:06

7K+ Views

It’s not possible to edit a JavaScript alert box title due to security issues. Still, to edit an alert box to work it all web browsers, use custom JavaScript Modal Dialogs or jQuery plugins.You can also use a custom alert box like Sweet Alert to get a custom alert box, with a title of your choice:

How to create a custom object in JavaScript?

vanithasree
Updated on 19-Sep-2019 08:11:53

554 Views

To create a custom object in JavaScript, try the following codeExampleLive Demo                          var dept = new Object();          dept.employee = "Amit";          dept.department = "Technical";          dept.technology ="Java";          document.getElementById("test").innerHTML =          dept.employee + " is working on " + dept.technology + " technology.";          

What is super() function in JavaScript?

radhakrishna
Updated on 08-Jan-2020 10:55:23

313 Views

Use the super() function to call the constructor of the parent class and access functions on an object's parent class.ExampleYou can try to run the following code to implement super()Live Demo                    class Department {             constructor() {}             static msg() {                return 'Hello';             }          }          class Employee extends Department {             constructor() {}             static displayMsg() {                return super.msg() + ' World!';             }          }          document.write(Employee.displayMsg());          

How to call a JavaScript function on submit form?

mkotla
Updated on 30-Jul-2019 22:30:21

16K+ Views

The onsubmit event occurs when you try to submit a form. You can put your form validation against this event type. The following example shows how to use onsubmit. Here we are calling a validate() function before submitting a form data to the webserver. If validate() function returns true, the form will be submitted, otherwise it will not submit the data.     The HTML code snippet. …

How to provide new line in JavaScript alert box?

Rishi Rathor
Updated on 08-Jan-2020 10:38:08

790 Views

To add a new line in JavaScript alert box, use the “”:alert("Line One Line Two");ExampleYou can try to run the following code add a new line in an alert box in JavaScript:Live Demo                                         Click the following button to see the result:                          

How to call a JavaScript function from an onmouseover event?

varma
Updated on 08-Jan-2020 10:36:14

2K+ Views

The onmouseover event triggers when you bring your mouse over any element.ExampleYou can try to run the following example to learn how to call a JavaScript function from onmouseover eventLive Demo                                         Bring your mouse inside the division to see the result:                 This is inside the division          

How to show prompt dialog box using JavaScript?

Disha Verma
Updated on 10-Mar-2025 16:35:01

880 Views

JavaScript has several built-in methods to create dialog boxes that allow users to interact with them. The prompt() method in JavaScript is one of them. The prompt dialog box is very useful when you want to pop up a text box to get user input. In this article, we'll explore how to use the prompt() method with examples. What is a Prompt Dialog Box? The prompt() method in JavaScript is used to display a dialog box that prompts the user for input. The prompt dialog box is very useful when you want to pop up a text box to ... Read More

How do you get a timestamp in JavaScript?

Shubham Vora
Updated on 25-Jul-2022 08:39:25

5K+ Views

In this tutorial, we will learn to get a timestamp in JavaScript. It never happens that software developers or application developers don’t require to play with date and time. In many situations, they are required to play with date and timestamp. For example, to show the time on the user’s dashboard, save the time of an operation in the database.Now, let’s understand what the timestamp is? The timestamp is the total number of milliseconds from the 1st January 1970 from when UNIX epochs begin. Using the timestamp, we can extract the date, day, year, month, hours, minutes, second, milliseconds, etc.So, ... Read More

How to use JavaScript to show a confirm message?

Abhishek Kumar
Updated on 10-Nov-2022 08:21:44

7K+ Views

In this tutorial, we will learn how to use JavaScript to show a confirm message. We use window.confirm() method of JavaScript to show a confirm message. A confirm message is enclosed in a confirm dialog box which is a modal window. Such a window takes focus upon being created and doesn’t go out of focus until the user responds to it. Confirmation dialog box in JavaScript A confirm message is a yes/no message for the user that requires immediate attention. A confirmation dialog box usually gets triggered in response to some action requested by the user. This action can be ... Read More

How to call a JavaScript function from an onClick event?

varun
Updated on 08-Jan-2020 10:32:26

2K+ Views

The onClick event is the most frequently used event type, which occurs when a user clicks the left button of the mouse. You can put your validation, warning etc., against this event type.ExampleYou can try to run the following code to call a JavaScript function from an onClick eventLive Demo                                         Click the following button and see result                          

Advertisements