0 votes
1 view
in Web Technology by (6.8k points)

I want to change the style of “OK” button in the alert box. How can I do it?

<head>

    <script type="text/javascript">

        function show_alert() {

            alert("Hello! I am an alert box!");

        }

    </script>

</head>

<body>

    <input type="button" onclick="show_alert()" value="Show alert box" />

</body>

1 Answer

0 votes
by (13k points)

To change the style you have to create an HTML element and mimic the alert() functionality. The jQuery UI Dialogue does a lot of the work for you.

Here is the example:
 

<!doctype html>

<html lang="en">

<head>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title>jQuery UI Dialog - Default functionality</title>

  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">

  <link rel="stylesheet" href="/resources/demos/style.css">

  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>

  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

  <script>

  $( function() {

    $( "#dialog" ).dialog();

  } );

  </script>

</head>

<body>

 

<div id="dialog" title="dialog">

  <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>

</div>

 

 

</body>

</html>

Want to be a Full Stack Developer? Check out the Full Stack Developer course from Intellipaat.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked 1 day ago in Java by sheela_singh (9.2k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...