Nhu Phung
Nhu Phung

Reputation: 79

how to remove or change the popup automatic message

I display a popup to ask confirmation of delete a record, the popup displays but with a "system message" like "the page at the address mywebsite show:" follows by my message "are you sure ....".

I want to display only my message 'Are you sure ?'Not the message 'the page at the address mywebsite show:' just above my message.

How can do this please ? Thank in advance.

<a href="php/Delete.php5?" onClick="return confirm('Are your sure ?');"><img src="images/Cancel16x16.png"></a>

Upvotes: 1

Views: 543

Answers (3)

SaidbakR
SaidbakR

Reputation: 13544

You could able to use modal to perform this message instead of javascript's confirm().

The following link shows you how to get it from the official documenation of jquery-ui: http://jqueryui.com/dialog/#modal-confirmation

Edit You are able to checkout this demo which is a modification from the official docs example: http://jsbin.com/iBApeKe/2/

Upvotes: 0

MackieeE
MackieeE

Reputation: 11862

The Title for the JavaScript confirm() is unfortunately unchangeable (See this SO question: Changing the default title of confirm() in JavaScript?) , That's the same for the changing any of the style & looks for it too.

To allow you to use common scripts such as callbacks, change of text or event changes etc. on JavaScript confirm()s. These better left for helpers such as jQuery UI Dialog (There are many others too) which uses <div>s to mimic the confirm() behaviour and provide much, much more control for a Web Developer.

<script>
    $(function() {
        $( "#userconfirm" ).on('click', function() {
           $('#dialog').dialog({ 
                title: "Your new Title"
           });
    });
</script>  

<a href="php/Delete.php5?" id="userconfirm">
   <img src="images/Cancel16x16.png">
</a>

<div id="dialog" title="Basic dialog">
     <p>Are you sure?</p>
</div>

Upvotes: 1

falinsky
falinsky

Reputation: 7428

You can use jquery ui dialog for such purposes

Upvotes: 0

Related Questions