

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to call JavaScript function in an alert box?
To call a JavaScript function in an alert box, you can try to run the following code −
Example
<!DOCTYPE html> <html> <body> <script> function myFunction(warning) { alert(warning); catchedAlert(); } function catchedAlert() { alert('Alert called!'); } </script> <button onclick="myFunction('This is an alert box!')">Click me!</button> </body> </html>
- Related Questions & Answers
- What is an alert box in JavaScript?
- How to customize the position of an alert box using JavaScript?
- How to edit a JavaScript alert box title?
- How to center the JavaScript alert message box?
- How to provide new line in JavaScript alert box?
- How to show image in alert box using JavaScript?
- How to display JavaScript variable value in alert box?
- How to design a custom alert box using JavaScript?
- How to change button label in alert box using JavaScript?
- How to create and apply CSS to JavaScript Alert box?
- Create an alert message box with Bootstrap
- How to change the color of the alert box in JavaScript?
- JavaScript Function Call
- How to call a function in JavaScript?
- How to call a JavaScript function from an onClick event?
Advertisements